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.