Catch All Exception in flash)

Source: Internet
Author: User

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 );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.