开发者

Can't seem to listen for UncaughtErrorEvent for SubApplication loaded by SWFLoader

I have a main Flex Application ('A.swf') loading a SubApplication (d开发者_开发问答efined in' B.swf') via a SWFLoader and I need to listen for UncaughtErrorEvent from the SubApplication. I'm not able to get my event listeners to be called when I throw an error from within the SubApp ('B.swf').

After reading the asDoc for UncaughtErrorEvent and UncaughtErrorEvents I have added an event listener to A.swf's loaderInfo (The 'outter' main app) and also to B.swf's loaderInfo (though the Docs say not to do it here it is part of the event sequence in the capture and bubble phase...) as well as the SWFLoader internal FlexLoader.uncaughtErrorEvent (per Docs) like so:

swfLoader.content.loaderInfo.loader.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorFunction );  

The event listener setup on the Loader.uncaughtErrorEvents is not firing when SubApplication in B.swf throws an error. Instead the listener on the main app's (A.swf) loaderInfo fires. Moreover, the event recieved by A.swf's loaderInfo has an eventphase equal to 'EventPhase.AT_TARGET' which the asDoc says should only be dispatched in the capture and bubble phases.

Am I not doing this correctly? Any thoughts or suggestions?

'A.swf' and 'B.swf' both compiled with Flex SDK 4.1, Flash Player 10.1. Browser is FireFox running Flash debug player 10.3

Thanks!


I found that setting the SDK libraries to merge into the code for both A.swf and B.swf allows the UnCaughtErrorEvents to dispatch in the correct way.

It doesn't dispatch when using MX based Flex Applications with the SDK libraries linked via Shared Runtime Libraries (the default in Flash Builder).

Moreover, it will also work with pure SPARK Flex Applications with RSL or merged into code.

See the discussion here: http://forums.adobe.com/message/3835326

Submitted Flex Bug here: http://bugs.adobe.com/jira/browse/SDK-30996 For examples see attachments on submitted bug.


See Alex Harui's blog post, that should work. http://blogs.adobe.com/aharui/2011/04/catching-uncaughterror-in-flex-modules.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜