MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference page 218

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

If the exception thrown is an object, the type will match if the thrown object is a subclass of
the specified type. If an error of a specific type is thrown, the
corresponding error is executed. If an exception that is not of the specified type is thrown, the
block does not execute and the exception is automatically thrown out of the
catch
to a
handler that matches it.
catch
If an error is thrown within a function, and the function does not include a
then the ActionScript interpreter exits that function, as well as any caller functions, until a
block is found. During this process,
catch
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
- The expression thrown from a
error:Object
Error class or one of its subclasses.
Example
The following example shows how to create a
block is guaranteed to execute, it is typically used to perform any necessary clean-up
finally
after a
block executes. In the following example,
try
1000 millisecond (1 second). If an error occurs, an error is thrown and is caught by the
block. The finally block is always executed whether or not an error occurs. Because
is used,
setInterval()
that the interval is cleared from memory.
myFunction = function () {
trace("this is myFunction");
};
try {
myInterval = setInterval(this, "myFunction", 1000);
throw new Error("my error");
}
catch (myError:Error) {
trace("error caught: "+myError);
}
finally {
clearInterval(myInterval);
trace("error is cleared");
}
218
ActionScript language elements
finally
must be placed in the
clearInterval()
catch
handlers are called at all levels.
statement, typically an instance of the
throw
statement. Because code in the
try..finally
setInterval()
finally
block that handles the
block
try
handler,
catch
calls a function every
catch
block to ensure

Advertisement

Table of Contents
loading

Table of Contents