ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
flash.errors 

ScriptTimeoutError  - AS3

Packageflash.errors
Classpublic dynamic class ScriptTimeoutError
InheritanceScriptTimeoutError Inheritance Error Inheritance Object

Language Version: ActionScript 3.0
Runtime Versions: AIR 1.0, Flash Player 9, Flash Lite 4

The ScriptTimeoutError exception is thrown when the script timeout interval is reached. The script timeout interval is 15 seconds.

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 the player from hanging indefinitely.

View the examples

More examples



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritederrorID : int
[read-only] Contains the reference number associated with the specific error message.
Error
 Inheritedmessage : String
Contains the message associated with the Error object.
Error
 Inheritedname : String
Contains the name of the Error object.
Error
Public Methods
 MethodDefined By
  
Creates a new ScriptTimeoutError object.
ScriptTimeoutError
 Inherited
Returns the call stack for an error at the time of the error's construction as a string.
Error
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
[override] Returns the string "Error" by default or the value contained in the Error.message property, if defined.
Error
 Inherited
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.

Parameters
message:String (default = "") — A string associated with the error object.
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:
  1. A keepLooking Boolean property is declared.
  2. The constructor calls the lockMachine() method within an error handling code segment that catches ScriptTimeoutError objects.
  3. The lockMachine() method contains an endless while loop.
  4. After awhile, the ScriptTimeoutError is thrown. The constructor catches it, outputs an error message through the trace statement and resets the keepLooking Boolean to false, which terminates the while loop in lockMachine().
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){        
            }
        }
    }
}