When I run a Flex application in the debug flash player I get an exception pop up as soon as something unexpected happened. I would like to catch any exception that can happen anywhere in the Flex code and if it happens don't allow Adobe Debug Flash Player open his pop up window with this exception or error. I tried:
[PostConstruct]
public function init():void
{
FlexGlobals.topLevelApplication.systemManager.stage.loaderInfo.
uncaughtErrorEvents.
addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR,uncaughtErrorHandler);
}
private function uncaughtErrorHandler(event:UncaughtErrorEvent):void
{
event.preventDefault();
event.stopImmediatePropagation();
}
but it don't work, general runtime error dialog will still pop up. I tried to prevent this, call event.preventDefault() inside my global error handler, but it don't work to me too. I'm using Flex 4.