03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - 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 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 />

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 />

Example<br />

The following example uses assignment by value to assign the value of 5 to the variable x.<br />

var x:Number = 5;<br />

The following example uses assignment by value to assign the value "hello" to the variable x:<br />

var x:String;x = " hello ";<br />

The following example uses assignment by reference to create the moonsOfJupiter variable,<br />

which contains a reference to a newly created Array object. Assignment by value is then used<br />

to copy the value "Callisto" to the first element of the array referenced by the variable<br />

moonsOfJupiter:<br />

var moonsOfJupiter:Array = new Array();moonsOfJupiter[0] = "Callisto";<br />

Operators 115

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

Saved successfully!

Ooh no, something went wrong!