I’d like to know whether there is a way to add an error handler for a #1502 execution time error in AS3.
A couple of notes:
-
I am aware that the max script execution time can be set on the publish options. It takes values as high as 16 bit (0-65535). So there is a max of 18 hours. The script does not get terminated after 60 seconds in the context I use it.
-
I use it in an application built with mProjector. There is an event listener on a button that opens a file browser dialogue. As long as the browser is open the event handler does not continue. If the maximum script execution time is exceeded I get the #1502.
-
If there is no way I’ll just set that limit very high. Nevertheless building something that will break if you leave a dialogue open for like a day is not neat. It’s never gonna happen but still I wondered if there is a proper way to avoid things like this.
Thanks.
Additional info:
Shortened code:
bttn.addEventListener(MouseEvent.CLICK, browse);
function browse(e:Event) {
var selectedFilesString:String = mSystem.chooseFiles(chooseFileTitle, initFileName, initFolderName, fileFilter, defaultFileType);
...
}
So this involves the mSystem.chooseFiles() method detailed here:
http://www.screentime.com/software/flash-projector/docs/AS3-mSys-chooseFiles.htm
But like I said I’m interested in wether there is an error handler for this error. Not in what might cause it and what does not or wether mProjector is well implemented or not etc.
EDIT
You can catch ScriptTimeoutError, but only once. See this blog post.