MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 231

Actionscript 2.0 language reference
Table of Contents

Advertisement

}]
Encloses a block of code in which an error can occur, and then respond to the error. If any
code in the
code block throws an error (using the
try
block, if one exists, and then to the
catch
block is always executed, regardless of whether an error was thrown. If code in the
doesn't throw an error (that is, if the
block is still executed. The
finally
using a
statement.
return
A
block must be followed by a
try
can have multiple
catch
many levels deep as necessary.
The
parameter specified in a
error
or
. The variable in a
theException
x
multiple
blocks, typed errors let you catch multiple types of errors thrown from a single
catch
block.
try
If the exception thrown is an object, the type matches 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 is not executed and the exception is automatically thrown out of the
catch
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 Player 7
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 be executed, it is typically used to perform any necessary
finally
clean-up after a
block is executed. In the following example,
try
function every 1000 millisecond (1 second). If an error occurs, an error is thrown and is
caught by the
catch
occurs. Because
setInterval()
block to ensure that the interval is cleared from memory:
block completes normally), then the code in the
try
finally
block, a
catch
blocks but only one
catch
catch
block. The finally block is always executed whether or not an error
is used,
clearInterval()
statement), control passes to the
throw
code block, if one exists. The
finally
block is executed even if the
block, or both. A single
finally
block. You can nest
finally
handler must be a simple identifier such as
handler can also be typed. When used with
catch
handlers are called at all levels.
finally
statement, typically an instance of the
throw
statement. Because code in the
try..finally
must be placed in the
finally
try
block exits
try
try
blocks as
try
block that handles the
block to
try
handler,
catch
calls a
setInterval()
finally
Statements
block
block
or
e
231

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF