03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

You can use the following <strong>ActionScript</strong> to loop over all objects in the _root scope, which is<br />

useful for debugging:<br />

for (i in _root) {<br />

trace(i+": "+_root[i]);<br />

}<br />

You can also use the array access ([]) operator on the left side of an assignment statement to<br />

dynamically set instance, variable, <strong>and</strong> object names:<br />

employee_array[2] = "Sam";<br />

See also<br />

Array, Object, eval function<br />

= assignment operator<br />

expression1 = expression2<br />

Assigns the value of expression2 (the parameter on the right) to the variable, array element,<br />

or property in expression1. Assignment can be either by value or by reference. Assignment<br />

by value copies the actual value of expression2 <strong>and</strong> stores it in expression1. Assignment by<br />

value is used when a variable is assigned a number or string literal. Assignment by reference<br />

stores a reference to expression2 in expression1. Assignment by reference is commonly<br />

used with the new operator. Use of the new operator creates an object in memory <strong>and</strong> a<br />

reference to that location in memory is assigned to a variable.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 4 - In Flash 4, = is a numeric equality operator. In<br />

Flash 5 or later, = is an assignment operator, <strong>and</strong> the == operator is used to evaluate equality.<br />

Flash 4 files that are brought into the Flash 5 or later authoring environment undergo a<br />

conversion process to maintain data type integrity.<br />

Flash 4 file: x = y<br />

Converted Flash 5 or later file: Number(x) == Number(y)<br />

Oper<strong>and</strong>s<br />

expression1 : Object - A variable, element of an array, or property of an object.<br />

expression2 : Object - A value of any type.<br />

Returns<br />

Object - The assigned value, expression2 .<br />

Operators 141

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!