In Flash Player 10.1 and later versions, adobe added the global error handling program UncaughtErrorEvents. Errors generated anywhere in the world can be captured in the capture and bubble phases if they are not captured.
The UncaughtErrorEvents object of the scheduled event is associated with the LoaderInfo object or Loader object. Use the following attributes to access the uncaughtErrorEvents instance:
LoaderInfo. uncaughtErrorEvents: detects uncaptured errors in codes defined in the same SWF.
Loader. uncaughtErrorEvents: detects uncaptured errors in the code defined in the SWF loaded by the Loader object.
If the content is running in the debugger version at runtime, an uncaptured error dialog box is displayed when an uncaptured error occurs. For these runtime versions, the error dialog box is displayed even if a listener is registered for the uncaughtError event. To prevent this dialog box from appearing, you can call the preventDefault () method of the UncaughtErrorEvent object.
However, the defect of this method is that you do not know where these errors come from, that is, you cannot trace the message source from the event, therefore, you cannot process specific messages.
If your project may be of version 10.1 or earlier, you 'd better
Flex code:Copy codeThe Code is as follows: if (loaderInfo. hasOwnProperty ("uncaughtErrorEvents "))
{
IEventDispatcher (loaderInfo ["uncaughtErrorEvents"]). addEventListener ("uncaughtError", uncaughtErrorHandler );
}