My Flash program loads a SWF containing user code that was compiled in real time. Because this is user code, it can throw exceptions. Unfortunately, I don't seem to catch the exception. This code does not work:
this._loader = new Loader();
this._loader.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onUncaughtError);
this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfCompleteHandler);
this._loader.loadBytes(swfByteArray, loaderContext);
However, the debug player shows this in an unhandled exception window:
[Fault] exception, information=Error: Test error message
at global$init() [User_Code:3]
How can I catch the exception in the global $ init () of the loaded SWF? I tried to add UNCAUGHT_ERROR event listeners to each loader and loaderInfo that I can find ... but none of them fire when an exception is thrown from the loaded SWF-global $ init (). Thanks in advance.