Run-time Error Handling for Flash App
I have been preparing an eSeminar on the topic of Flash Security. It was then I started reading about the subject of run-time error handling, like how to handle when security does not permit certain actions. Broadly speaking, there are asynchronous run-time error and synchronous run-time error.
Below is an example of handling async security run-time error when loading of external data is not permitted. As you can see the way to deal with this is to use event listener:
var xmlData:URLLoader = new URLLoader();
// use event listener to handle asynchronous error
Below is an example of handling sync security run-time error when cross-scripting is not permitted. As you can see the way to handle this is to use try/catch mechanism:
var swfContent:Loader = new Loader();
swfContent.x = swfContent.y = 0;
// use a try and catch block to handle synchronous error
You can find more details description of error handling at the AS 3 help.