Operator
Operation performed
%=
Modulo and assignment
Division and assignment
/=
Bitwise shift left and assignment
<<=
>>=
Bitwise shift right and assignment
>>>=
Shift right zero fill and assignment
Bitwise XOR and assignment
^=
Bitwise OR and assignment
|=
&=
Bitwise AND and assignment
Dot and array access operators
You can use the dot operator (
ActionScript object properties, including those of a movie clip.
The dot operator uses the name of an object on its left side and the name of a property or variable
on its right side. The property or variable name can't be a string or a variable that evaluates to a
string; it must be an identifier. The following examples use the dot operator:
year.month = "June";
year.month.day = 9;
The dot operator and the array access operator perform the same role, but the dot operator takes
an identifier as its property, whereas the array access operator evaluates its contents to a name and
then accesses the value of that named property. For example, the following expressions access the
same variable
velocity
rocket.velocity;
rocket["velocity"];
You can use the array access operator to dynamically set and retrieve instance names and variables.
For example, in the following code, the expression inside the
result of the evaluation is used as the name of the variable to be retrieved from movie clip
name["mc" + i]
You can also use the
eval("mc" + i)
The array access operator can also be used on the left side of an assignment statement. This allows
you to dynamically set instance, variable, and object names, as shown in the following example:
name[index] = "Gary";
) and the array access operator (
.
in the movie clip
rocket
function, as shown here:
eval()
[]
:
operator is evaluated, and the
[]
Using operators to manipulate values in expressions
) to access built-in or custom
:
name
49
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?
Questions and answers