开发者

How to capture the uncaught exceptions of AS3 program?

I want to log those 开发者_开发百科uncaught exceptions of my as3 program. The problem is, where do those uncaught exceptions go? How can I catch them?

Thanks.


FlashPlayer 10.1 solves the problem: http://www.sephiroth.it/weblog/archives/2009/12/flash_player_101_and_global_error_han.php

you might wanna grab a pre-release.

greetz
back2dos


place all your code in the main method inside a try - catch block


There is no single way to catch all uncaught exceptions programmatically. You can install the debug version of Flash player from Adobe and you'll get to see all uncaught exceptions. It'll be thrown through a popup that pauses flash player until it is dismissed. The current function stack will be terminated. The popup will show the line numbers and the stack trace so that you can locate the issue easily.

If you want to avoid uncaught exceptions, you will have to put contents of all functions that are explicitly called by the Flash player inside try-catch blocks. This include the document class constructor, mouse and key handlers, timer handlers, URL/Loader handlers and any other event handler that you have.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜