How to catch all exceptions in Flex?

前端 未结 9 739
广开言路
广开言路 2020-11-29 23:39

When I run a Flex application in the debug flash player I get an exception pop up as soon as something unexpected happened. However when a customer uses the application he d

9条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 00:31

    I'm using flex 4. I tried loaderInfo.UncaughtErrorEvents, but loaderInfo was not initialized so it gave me null reference error. Then i tried root.loaderInfo.UncaughtErrorEvents and the same story. I tried sprite.root.UncaughtErrorEvents, but there was no sprite object, I created one, but it didn't work. Finally I tried

    systemManager.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR,globalUnCaughtErrorHandler.hanleUnCaughtError);

    And guess what, it works like magic. check this

提交回复
热议问题