My Flash program's loading a SWF that contains user code which has been compiled in real time. Because it's user code, it may throw exceptions. Unfortunately, I can't seem to catch the exceptions. This code doesn't 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 the unhandled exception dialog:
[Fault] exception, information=Error: Test error message
at global$init() [User_Code:3]
How do I catch an exception in global$init() of a loaded SWF? I've tried adding UNCAUGHT_ERROR event listeners to every loader and loaderInfo I can find... but none of them trigger when the exception is thrown from the loaded SWF's global$init(). Thanks in advance.