Made to Order Software Corporation Logo

Try

SWF Action
Action Category: 
Control
Action Details: 
0
Action Identifier: 
143
Action Structure: 
unsigned char     f_try_reserved : 5;
unsigned char     f_catch_in_register : 1;
unsigned char     f_finally : 1;
unsigned char     f_catch : 1;
unsigned short    f_try_size;
unsigned short    f_catch_size;
unsigned short    f_finally_size;
if(f_catch_in_register == 0) {
  string                   f_catch_name;
}
else {
  unsigned char    f_catch_register;
}
Action Length: 
-1 byte(s)
Action Stack: 
n.a.
Action Operation: 
try { ... }
catch(name) { ... }
finally { ... }
Action Flash Version: 
7
See Also: 

Declare a try/catch/finally block.

This has the behavior of the action script:

	try { ... }
	catch(name) { ... }
	finally { ... }

In version 7, there are no definition of exceptions in the ActionScript interpreter. However, you can write functions that Throw.

The semantic of the try/catch/finally block is very well defined in ECMA 262 version 3 (see pages 87/88).

f_finally and f_catch may not both be zero or the semantic of the try block would be invalid. f_try_size, f_catch_size and f_finally_size are defined in bytes and give the size of each of the block of instructions just like a function definition.

IMPORTANT
Do not terminate these blocks with an End action

When f_catch_in_register is set to 1, a register number is specified instead of a variable name. This will usually be faster. Note that the variable name or register number should not overwrite another variable or register to be fully compliant.

Note that the stack is used only if the a function throws an exception and it is used internally (whether or not you defined a catch). So this is why it is marked as n.a. since from before or after the statements, the stack will be the same.