【发布时间】:2011-08-17 09:14:12
【问题描述】:
我一直在尝试在 AS3 的异步代码中发生错误时提供更好的调试信息。
作为默认错误报告的示例,以我在 Timer 回调 (github gist) 中强制使用空指针的情况为例,我在控制台上得到以下堆栈跟踪:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Function/<anonymous>()[/[path-to-source-file]/TestClass.as:14]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
这很少告诉我计时器回调如何实际链接到我的代码。
问题是:如何获取有关创建回调的代码的信息?
我在下面添加了我的解决方案之一。我有兴趣看看这是否可以改进。
【问题讨论】:
标签: actionscript-3 debugging actionscript asynchronous event-handling