Assignment Operator - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

= assignment operator

expression1 = expression2
Assigns the value of
expression2
or property in
expression1
by value copies the actual value of
value is used when a variable is assigned a number or string literal. Assignment by reference
stores a reference to
expression2
used with the
operator. Use of the
new
reference to that location in memory is assigned to a variable.
Availability: ActionScript 1.0; Flash Lite 1.0 - In Flash 4,
Flash 5 or later,
is an assignment operator, and the
=
Flash 4 files that are brought into the Flash 5 or later authoring environment undergo a
conversion process to maintain data type integrity.
Flash 4 file:
x = y
Converted Flash 5 or later file:
Operands
expression1 :
Object
expression2 :
Object
Returns
- The assigned value,
Object
Example
The following example uses assignment by value to assign the value of 5 to the variable
var x:Number = 5;
The following example uses assignment by value to assign the value "
var x:String;x = " hello ";
The following example uses assignment by reference to create the moonsOfJupiter variable,
which contains a reference to a newly created Array object. Assignment by value is then used
to copy the value "Callisto" to the first element of the array referenced by the variable
:
moonsOfJupiter
var moonsOfJupiter:Array = new Array();moonsOfJupiter[0] = "Callisto";
(the parameter on the right) to the variable, array element,
. Assignment can be either by value or by reference. Assignment
expression2
in
expression1
operator creates an object in memory and a
new
Number(x) == Number(y)
- A variable, element of an array, or property of an object.
- A value of any type.
.
expression2
and stores it in
expression1
. Assignment by reference is commonly
is a numeric equality operator. In
=
operator is used to evaluate equality.
==
hello
. Assignment by
.
x
" to the variable
:
x
Operators
123

Advertisement

Table of Contents
loading

Table of Contents