开发者

AS3 trace, specially errors message to a textbox

开发者 https://www.devze.com 2023-01-22 13:28 出处:网络
I\'d like to be able to redirect the traces, and even more then traces the flash error reports to a text-box inside my flash app, so I can see the bug report in a computer that doesn\'t have flash-pla

I'd like to be able to redirect the traces, and even more then traces the flash error reports to a text-box inside my flash app, so I can see the bug report in a computer that doesn't have flash-player debugger version or flashbug installed.

Any error message that comes on in my app should show in this tex开发者_开发技巧tbox.

How can I do this?


Create your own error reporting class with a simple TextField and an event listener which will update your TextField content by returning the text property of a custom event or a Signal you would dispatch , wherever you need to add a trace statement in your application.

For simplicity's sake and since this is only used as a development tool , create a Singleton whose sole purpose will be to dispatch & receive events.

Edit: Re: a global error handler, you could have a look at this , but it seems that it's still in beta http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/events/UncaughtErrorEvent.html


For traces, you can try to declare your own trace function, which will accumulate messages and show them when some key is pressed. For exceptions, they must be caught and traced. In AIR, there is global exception handler, but not in Flash.

0

精彩评论

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