Package | flash.errors |
Class | public dynamic class ScriptTimeoutError |
Inheritance | ScriptTimeoutError Error Object |
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.0 |
mx:Application
tag: scriptTimeLimit
(the number of seconds until script timeout) and scriptRecursionLimit
(the depth of recursive calls permitted).
Two ScriptTimeoutError exceptions are thrown. The first exception you can catch and exit cleanly. If there is no exception handler, the uncaught exception terminates execution. The second exception is thrown but cannot be caught by user code; it goes to the uncaught exception handler. It is uncatchable to prevent Flash® Player from hanging indefinitely.
Public Properties
Public Methods
Method | Defined By | ||
---|---|---|---|
ScriptTimeoutError(message:String = "")
Creates a new ScriptTimeoutError object. | ScriptTimeoutError | ||
Returns the call stack for an error as a string at the time of the error's construction (for the debugger version
of Flash Player and the AIR Debug Launcher (ADL) only; returns null if not using the debugger version
of Flash Player or the ADL. | Error | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
[override]
Returns the string "Error" by default or the value contained in the Error.message property,
if defined. | Error | ||
Returns the primitive value of the specified object. | Object |
Constructor Detail
ScriptTimeoutError | () | Constructor |
public function ScriptTimeoutError(message:String = "")
Language Version: | ActionScript 3.0 |
Runtime Versions: | AIR 1.0 Flash Player 9 |
Creates a new ScriptTimeoutError object.
Parametersmessage:String (default = " ") — A string associated with the error object.
|
Examples ( How to use this example )
ScriptTimeoutErrorExample.as
The following example uses the sample ScriptTimeoutErrorExample class to show
the error generated in the event of script timeout. This is accomplished with the following
steps:
- A
keepLooking
Boolean property is declared. - The constructor calls the
lockMachine()
method within an error handling code segment that catches ScriptTimeoutError objects. - The
lockMachine()
method contains an endlesswhile
loop. - After awhile, the ScriptTimeoutError is thrown. The constructor catches it,
outputs an error message through the
trace
statement and resets thekeepLooking
Boolean tofalse
, which terminates thewhile
loop inlockMachine()
.
package { import flash.display.Sprite; import flash.errors.ScriptTimeoutError; public class ScriptTimeoutErrorExample extends Sprite { private var keepLooping:Boolean = true; public function ScriptTimeoutErrorExample() { try { lockMachine(); } catch(e:ScriptTimeoutError) { trace(e); // ScriptTimeoutError: Error #1502: A script has executed for longer than 15 seconds keepLooping = false; } } private function lockMachine():void { while(keepLooping){ } } } }
Fri Mar 19 2010, 02:45 AM -07:00