Flex global error handling: The global error handler code is compatible with the Flash Player of earlier versions.

Source: Internet
Author: User

Global error handler is added from Flash Player 10.1.x.CodeRun on Flash Player
If you use a FP of 10.0.x or a later version, SwF will fail.
So what method can be used to enable the replacement of global error handler in Flash Player?
10.1.x can be used normally, but does not cause SWF errors in earlier FP versions?

See the following code:

Code

  Private function setglobalerrorhandler (Event: flexevent): void {
If (! Loaderinfo. hasownproperty ("uncaughterrorevents") return;
Object (loaderinfo). uncaughterrorevents. addeventlistener ("uncaughterror", onuncaughterror );
Function onuncaughterror (Event: Event): void {
VaR message: String = Object (Event). Error. getstacktrace ();
If (! Message ){
If (Object (Event). error is error ){
Message = Error (Object (Event). Error). message;
}
Else if (Object (Event). error is errorevent ){
Message = errorevent (Object (Event). Error). text;
}
Else {
Message = Object (Event). Error. tostring ();
}
}
}
}

 

p.s.
you cannot set. addeventlistener ("uncaughterror",
onuncaughterror); changed. addeventlistener (uncaughterrorevent. uncaught_error,
onuncaughterror);
SWF errors may occur because uncaughterrorevent is not found in FP of earlier versions.

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.