Made to Order Software Corporation Logo

Set Local Variable

SWF Action
Action Category: 
Action Details: 
Action Identifier: 
Action Structure: 
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (a), pop 1 (s)
Action Operation: 
a1 := pop();
s2 := pop();
*s2 := a1;
Action Flash Version: 

Pop a value and a local variable name. Create or set a local variable of that name with the (initial) value as specified. The same local variable can safely be set in this way multiple times. To only declare a local variable (i.e. no default value to initialize the variable,) use the Declare Local Variable instead.

Note that the Get Variable action automatically gets a local variable if it exists. In order to still access a global variable, use the path syntax as in "/my_var".

Instead of local variables, it is also possible to use registers. There are 4 in Flash versions 4 through 6. Since version 7, you have access to 254 registers in Declare Function (V7). Remember, however, that if you tell users that they can always access a variable by name, then they could dynamically generate the name in which case changing such a variable into a register will break their code.


Post new comment

The content of this field is kept private and will not be shown publicly.
This question is for testing whether you are a human visitor and to prevent automated spam submissions.