Operators


Symbolic operators are characters that specify how to combine, compare, or modify the values of an expression.

Arithmetic
+additionAdds numeric expressions or concatenates (combines) strings.
--decrementA pre-decrement and post-decrement unary operator that subtracts 1 from the expression.
/divisionDivides expression1 by expression2.
++incrementA pre-increment and post-increment unary operator that adds 1 to expression .
%moduloCalculates the remainder of expression1 divided by expression2.
*multiplicationMultiplies two numerical expressions.
-subtractionUsed for negating or subtracting.
Arithmetic Compound Assignment
+=addition assignmentAssigns expression1 the value of expression1 + expression2.
/=division assignmentAssigns expression1 the value of expression1 / expression2.
%=modulo assignmentAssigns expression1 the value of expression1 % expression2.
*=multiplication assignmentAssigns expression1 the value of expression1 * expression2.
-=subtraction assignmentAssigns expression1 the value of expression1 - expression2.
Assignment
=assignmentAssigns the value of expression2 (the parameter on the right) to the variable, array element, or property in expression1.
Bitwise
&bitwise ANDConverts expression1 and expression2 to 32-bit unsigned integers, and performs a Boolean AND operation on each bit of the integer parameters.
<<bitwise left shiftConverts expression1 and expression2 to 32-bit integers, and shifts all the bits in expression1 to the left by the number of places specified by the integer resulting from the conversion of expression2.
~bitwise NOTAlso known as the one's complement operator or the bitwise complement operator.
|bitwise ORConverts expression1 and expression2 to 32-bit unsigned integers, and returns a 1 in each bit position where the corresponding bits of either expression1 or expression2 are 1.
>>bitwise right shiftConverts expression1 and expression2 to 32-bit integers, and shifts all the bits in expression1 to the right by the number of places specified by the integer that results from the conversion of expression2.
>>>bitwise unsigned right shiftThe same as the bitwise right shift (>> ) operator except that it does not preserve the sign of the original expression because the bits on the left are always filled with 0. Floating-point numbers are converted to integers by discarding any digits after the decimal point.
^bitwise XORConverts expression1 and expression2 to 32-bit unsigned integers, and returns a 1 in each bit position where the corresponding bits in expression1 or expression2 , but not both, are 1.
Bitwise Compound Assignment
&=bitwise AND assignmentAssigns expression1 the value of expression1 & expression2.
<<=bitwise left shift and assignmentThis operator performs a bitwise left shift (<<=) operation and stores the contents as a result in expression1.
|=bitwise OR assignmentAssigns expression1 the value of expression1 | expression2.
>>=bitwise right shift and assignmentThis operator performs a bitwise right-shift operation and stores the contents as a result in expression1.
>>>=bitwise unsigned right shift and assignmentPerforms an unsigned bitwise right-shift operation and stores the contents as a result in expression1.
^=bitwise XOR assignmentAssigns expression1 the value of expression1 ^ expression2.
Comment
/*..*/block comment delimiterIndicates one or more lines of script comments.
//line comment delimiterIndicates the beginning of a script comment.
Comparison
==equalityTests two expressions for equality.
eqequality (strings)Deprecated since Flash Player 5 — This operator was deprecated in favor of the == (equality) operator.
>greater thanCompares two expressions and determines whether expression1 is greater than expression2; if it is, the operator returns true.
gtgreater than (strings)Deprecated since Flash Player 5 — This operator was deprecated in favor of the > (greater than) operator.
>=greater than or equal toCompares two expressions and determines whether expression1 is greater than or equal to expression2 (true) or expression1 is less than expression2 (false).
gegreater than or equal to (strings)Deprecated since Flash Player 5 — This operator was deprecated in favor of the >= (greater than or equal to) operator.
!=inequalityTests for the exact opposite of the equality (== ) operator.
<>inequalityDeprecated since Flash Player 5 — This operator has been deprecated. Macromedia recommends that you use the != (inequality) operator.
<less thanCompares two expressions and determines whether expression1 is less than expression2 ; if so, the operator returns true.
ltless than (strings)Deprecated since Flash Player 5 — This operator was deprecated in favor of the < (less than) operator.
<=less than or equal toCompares two expressions and determines whether expression1 is less than or equal to expression2 ; if it is, the operator returns true.
leless than or equal to (strings)Deprecated since Flash Player 5 — This operator was deprecated in Flash 5 in favor of the <= (less than or equal to) operator.
nenot equal (strings)Deprecated since Flash Player 5 — This operator was deprecated in favor of the != (inequality) operator.
===strict equalityTests two expressions for equality; the strict equality (=== )operator performs in the same way as the equality (== ) operator, except that data types are not converted.
!==strict inequalityTests for the exact opposite of the strict equality ( === ) operator.
Logical
&&logical ANDPerforms a Boolean operation on the values of both expressions.
andlogical ANDDeprecated since Flash Player 5 — Macromedia recommends that you use the logical AND (&&) operator.
!logical NOTInverts the Boolean value of a variable or expression.
notlogical NOTDeprecated since Flash Player 5 — This operator was deprecated in favor of the ! (logical NOT) operator.
||logical OREvaluates expression1 (the expression on the left side of the operator) and returns true if the expression evaluates to true.
orlogical ORDeprecated since Flash Player 5 — This operator was deprecated in favor of the || (logical OR) operator.
Other
[]array accessInitializes a new array or multidimensional array with the specified elements (a0 , and so on), or accesses elements in an array.
,commaEvaluates expression1 , then expression2 , and so on.
addconcatenation (strings)Deprecated since Flash Player 5 — Macromedia recommends that you use the add (+) operator when creating content for Flash Player 5 or later. This operator is not supported in Flash Player 8 or later.
?:conditionalInstructs Flash to evaluate expression1 , and if the value of expression1 is true , it returns the value of expression2 ; otherwise it returns the value of expression3.
.dotUsed to navigate movie clip hierarchies to access nested (child) movie clips, variables, or properties.
instanceofTests whether object is an instance of classConstructor or a subclass of classConstructor.
newCreates a new, initially anonymous, object and calls the function identified by the constructor parameter.
{}object initializerCreates a new object and initializes it with the specified name and value property pairs.
()parenthesesPerforms a grouping operation on one or more parameters, performs sequential evaluation of expressions, or surrounds one or more parameters and passes them as parameters to a function outside the parentheses.
"string delimiterWhen used before and after characters, quotation marks (") indicate that the characters have a literal value and are considered a string, not a variable, numerical value, or other ActionScript element.
:typeUsed for strict data typing; this operator specifies the variable type, function return type, or function parameter type.
typeofThe typeof operator evaluate the expression and returns a string specifying whether the expression is a String, MovieClip, Object, Function, Number, or Boolean value.
voidThe void operator evaluates an expression and then discards its value, returning undefined


Operator Details

+

addition Operator

Usage
expression1 + expression2

Player version: Flash Player 4 — In Flash 4, + is only a numeric operator. In Flash Player 5 and later, + is either a numeric operator or a string concatenator depending on the data type of the parameter. Flash 4 files that are brought into the Flash 5 or later authoring environment undergo a conversion process to maintain data type integrity. The following example illustrates the conversion of a Flash 4 file containing a numeric quality comparison:

Flash 4 file: x + y

Converted Flash 5 or later file: Number(x) + Number(y)

Adds numeric expressions or concatenates (combines) strings. If one expression is a string, all other expressions are converted to strings and concatenated.
If both expressions are integers, the sum is an integer; if either or both expressions are floating-point numbers, the sum is a floating-point number.

Operands
expression1 — A number or string.
expression2:Number — A number or string.

Result
Object — A string, integer, or floating-point number.

Example
Usage 1: The following example concatenates two strings and displays the result in the Output panel.
Usage 1: The following example concatenates two strings and writes the result to the log file.
var name:String = "Cola"; 
var instrument:String = "Drums"; 
trace(name + " plays " + instrument); // output: Cola plays Drums 
Usage 2: This statement adds the integers 2 and 3 and displays the resulting integer, 5, in the Output panel:
Usage 2: This statement adds the integers 2 and 3 and writes the resulting integer, 5, to the log file:
trace(2 + 3); // output: 5 
This statement adds the floating-point numbers 2.5 and 3.25 and displays the resulting floating-point number, 5.75, in the Output panel This statement adds the floating-point numbers 2.5 and 3.25 and writes the resulting floating-point number, 5.75, to the log file:
trace(2.5 + 3.25); // output: 5.75 
Usage 3: Variables associated with dynamic and input text fields have the data type String. In the following example, the variable deposit is an input text field on the Stage. After a user enters a deposit amount, the script attempts to add deposit to oldBalance. However, because deposit is a String data type, the script concatenates (combines to form one string) the variable values rather than summing them.
var oldBalance:Number = 1345.23; 
var currentBalance = deposit_txt.text + oldBalance; 
trace(currentBalance); 
For example, if a user enters 475 in the deposit text field, the trace() statement sends the value 4751345.23 to the Output panel. To correct this, use the Number() function to convert the string to a number, as in the following:
var oldBalance:Number = 1345.23; 
var currentBalance:Number = Number(deposit_txt.text) + oldBalance; 
trace(currentBalance);
The following example shows how numeric sums to the right of a string expression are not calculated:
var a:String = 3 + 10 + "asdf"; 
trace(a); // 13asdf 
var b:String = "asdf" + 3 + 10; 
trace(b); // asdf310 


+=

addition assignment Operator

Usage
expression1 += expression2

Player version: Flash Player 4

Assigns expression1 the value of expression1+ expression2. For example, the following two statements have the same result:

x += y; 
x = x + y; 
This operator also performs string concatenation. All the rules of the addition (+) operator apply to the addition assignment (+=) operator.

Operands
expression1:Number — A number or string.
expression2:Number — A number or string.

Result
Number — The result of the addition.

Example
Usage 1: This example uses the+= operator with a string expression and sends "My name is Gilbert" to the Output panel. Usage 1: This example uses the+= operator with a string expression and writes "My name is Gilbert" to the log file.
var x1:String = "My name is "; 
x1 += "Gilbert"; 
trace(x1); // output: My name is Gilbert 
Usage 2: The following example shows a numeric use of the addition assignment (+=) operator:
var x:Number = 5; 
var y:Number = 10; 
x += y; 
trace(x); // output: 15 

See also
+ (addition)

[]

array access Operator

Usage
myArray = [ a0, a1,...aN ]
myArray[ i ] = value
myObject [ propertyName ]

Player version: Flash Player 4

Initializes a new array or multidimensional array with the specified elements (a0, and so on), or accesses elements in an array. The array access operator lets you dynamically set and retrieve instance, variable, and object names. It also lets you access object properties.

Usage 1: An array is an object whose properties are called elements, which are each identified by a number called an index. When you create an array, you surround the elements with the array access ([]) operator (or brackets). An array can contain elements of various types. For example, the following array, called employee, has three elements; the first is a number and the second two are strings (inside quotation marks):

var employee:Array = [15, "Barbara", "Jay"]; 
You can nest brackets to simulate multidimensional arrays. You can nest arrays up to 256 levels deep. The following code creates an array called ticTacToe with three elements; each element is also an array with three elements:
var ticTacToe:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; 
// Select Debug > List Variables in test mode 
// to see a list of the array elements. 
Usage 2: Surround the index of each element with brackets ([]) to access it directly; you can add a new element to an array, or you can change or retrieve the value of an existing element. The first index in an array is always 0, as shown in the following example:
var my_array:Array = new Array(); 
my_array[0] = 15; 
my_array[1] = "Hello"; 
my_array[2] = true; 
You can use brackets ([]) to add a fourth element, as shown in the following example:
my_array[3] = "George"; 
You can use brackets ([]) to access an element in a multidimensional array. The first set of brackets identifies the element in the original array, and the second set identifies the element in the nested array. The following lines of code send the number 6 to the Output panel. The following line of code sends the number 6 to the log file.
var ticTacToe:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; 
trace(ticTacToe[1][2]);// output: 6 
Usage 3: You can use the array access ([]) operator instead of the eval() function to dynamically set and retrieve values for movie clip names or any property of an object. The following line of code sends the number 6 to the Output panel. The following line of code sends the number 6 to the log file.
name["mc" + i] = "left_corner"; 

Operands
myArray:ObjectmyArray The name of an array.
a0, a1,...aN:Objecta0,a1,...aN Elements in an array; any native type or object instance, including nested arrays.
i:Numberi An integer index greater than or equal to 0.
myObject:ObjectmyObject The name of an object.
propertyName:StringpropertyName A string that names a property of the object.

Result
Object

Usage 1: A reference to an array.

Usage 2: A value from the array; either a native type or an object instance (including an Array instance).

Usage 3: A property from the object; either a native type or an object instance (including an Array instance).

Example
The following example shows two ways to create a new empty Array object; the first line uses brackets ([]):
var my_array:Array = []; 
var my_array:Array = new Array(); 

The following example creates an array called employee_array and uses the trace() statement to send the elements to the Output panel. In the fourth line, an element in the array is changed, and the fifth line sends the newly modified array to the Output panel:

The following example creates an array called employee_array and uses the trace() statement to send the elements to the log file. In the fourth line, an element in the array is changed, and the fifth line sends the newly modified array to the log file:

var employee_array = ["Barbara", "George", "Mary"]; 
trace(employee_array); // output: Barbara,George,Mary 
employee_array[2] = "Sam"; 
trace(employee_array); // output: Barbara,George,Sam 
In the following example, the expression inside the brackets ("piece" + i ) is evaluated and the result is used as the name of the variable to be retrieved from the my_mc movie clip. In this example, the variable i must live on the same Timeline as the button. If the variable i is equal to 5, for example, the value of the variable piece5 in the my_mc movie clip is displayed in the Output panel:
myBtn_btn.onRelease = function() { 
    x = my_mc["piece"+i]; 
    trace(x); 
}; 
In the following example, the expression inside the brackets is evaluated, and the result is used as the name of the variable to be retrieved from movie clip name_mc:
name_mc["A" + i]; 
If you are familiar with the Flash 4 ActionScript slash syntax, you can use the eval() function to accomplish the same result:
eval("name_mc.A" & i); 
You can use the following ActionScript to loop over all objects in the _root scope, which is useful for debugging:
for (i in _root) { 
    trace(i+": "+_root[i]); 
} 
You can also use the array access ([]) operator on the left side of an assignment statement to dynamically set instance, variable, and object names:
employee_array[2] = "Sam";

See also
Array class, Object class, eval()

=

assignment Operator

Usage
expression1 = expression2

Player version: Flash Player 4 — In Flash 4, = is a numeric equality operator. In Flash 5 or later, = is an assignment operator, and the == operator is used to evaluate equality. 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:
Number(x) == Number(y)

Assigns the value of expression2 (the parameter on the right) to the variable, array element, or property in expression1. Assignment can be either by value or by reference. Assignment by value copies the actual value of expression2 and stores it in expression1 . Assignment by value is used when a variable is assigned a number or string literal. Assignment by reference stores a reference to expression2 in expression1. Assignment by reference is commonly used with the new operator. Use of the new operator creates an object in memory and a reference to that location in memory is assigned to a variable.

Operands
expression1:Object — A variable, element of an array, or property of an object.
expression2:Object — A value of any type.

Result
Object — The assigned value, expression2 .

Example
The following example uses assignment by value to assign the value of 5 to the variable x.
var x:Number = 5;

The following example uses assignment by value to assign the value "hello" to the variable x:

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 following example uses assignment by reference to create a new object, and assign a reference to that object to the variable mercury. Assignment by value is then used to assign the value of 3030 to the diameter property of the mercury object:

var mercury:Object = new Object(); mercury.diameter = 3030; // in miles 
trace (mercury.diameter); // output: 3030

The following example builds upon the previous example by creating a variable named merkur (the German word for mercury) and assigning it the value of mercury. This creates two variables that reference the same object in memory, which means you can use either variable to access the object's properties. We can then change the diameter property to use kilometers instead of miles:

var merkur:Object = mercury;
merkur.diameter = 4878; // in kilometers
trace (mercury.diameter); // output: 4878

See also
== (equality)

&

bitwise AND Operator

Usage
expression1 & expression2

Player version: Flash Player 5 — In Flash 4, the AND (&) operator was used for concatenating strings. In Flash 5 and later, the AND (&) operator is a bitwise AND, and you must use the addition (+) operator to concatenate strings. Flash 4 files that use the AND (&) operator are automatically updated to use addition (+) operator when imported into the Flash 5 or later authoring environment.

Converts expression1 and expression2 to 32-bit unsigned integers, and performs a Boolean AND operation on each bit of the integer parameters. Floating-point numbers are converted to integers by discarding any digits after the decimal point. The result is a new 32-bit integer.

Positive integers are converted to an unsigned hexadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted, therefore their value is still 32-bit. Negative numbers are converted to an unsigned hexadecimal value using two's complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's complement with greater precision and then have the most significant dig its discarded as well.

The return value is interpreted as a two's complement number with sign, so the return is an integer in the range -2147483648 to 2147483647.

Operands
expression1:Number — A number.
expression2:Number — A number.

Result
Number — The result of the bitwise operation.

Example
The following example compares the bit representation of the numbers and returns 1 only if both bits at the same position are 1. In this ActionScript, you add 13 (binary 1101) and 11 (binary 1011) and return 1 only in the position where both numbers have a 1.
var insert:Number = 13; 
var update:Number = 11; 
trace(insert & update); // output : 9 (or 1001 binary) 
In the numbers 13 and 11 the result is 9 because only the first and last positions in both numbers have the number 1.

The following examples show the behavior of the return value conversion:

trace(0xFFFFFFFF); // 4294967295 
trace(0xFFFFFFFF & 0xFFFFFFFF); // -1 
trace(0xFFFFFFFF & -1); // -1 
trace(4294967295 & -1); // -1 
trace(4294967295 & 4294967295); // -1 

See also
&= (bitwise AND assignment), ^ (bitwise XOR), ^= (bitwise XOR assignment), | (bitwise OR), |= (bitwise OR assignment), ~ (bitwise NOT)

&=

bitwise AND assignment Operator

Usage
expression1 &= expression2

Player version: Flash Player 5

Assigns expression1 the value of expression1 & expression2. For example, the following two expressions are equivalent:

x &= y; 
x = x & y; 

Operands
expression1:Number — A number.
expression2:Number — A number.

Result
Number — The value of expression1 & expression2 .

Example
The following example assigns the value 9 to x:
var x:Number = 15; 
var y:Number = 9; 
trace(x &= y); // output: 9 

See also
&(bitwise AND), ^ (bitwise XOR), ^= (bitwise XOR assignment), | (bitwise OR), |= (bitwise OR assignment), ~ (bitwise NOT)

<<

bitwise left shift Operator

Usage
expression1 << expression2

Player version: Flash Player 5

Converts expression1 and expression2 to 32-bit integer values; you can call them V1 and V2. Shifts all bits of the value of V1 to the left by V2 positions. Discards bits shifted off the left end of V1 by this operation, and inserts zeros in the bit positions on the right that are emptied. Shifting a value left by one position is the equivalent of multiplying it by 2.

Floating-point numbers are converted to integers by discarding any digits after the decimal point. Positive integers are converted to an unsigned hexadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hexadecimal value via the two's complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's complement with greater precision and also have the most significant digits discarded.

The return value is interpreted as a two's complement number with sign, so the return value will be an integer in the range -2147483648 to 2147483647.

Operands
expression1:Number — A number or expression to be shifted left.
expression2:Number — A number or expression that converts to an integer from 0 to 31.

Result
Number — The result of the bitwise operation.

Example
In the following example, the integer 1 is shifted 10 bits to the left: x = 1 << 10 The result of this operation is x = 1024. This is because 1 decimal equals 1 binary, 1 binary shifted left by 10 is 10000000000 binary, and 10000000000 binary is 1024 decimal. In the following example, the integer 7 is shifted 8 bits to the left: x = 7 << 8 The result of this operation is x = 1792. This is because 7 decimal equals 111 binary, 111 binary shifted left by 8 bits is 11100000000 binary, and 11100000000 binary is 1792 decimal. If you trace the following example, you see that the bits have been pushed two spaces to the left:
// 2 binary == 0010 
// 8 binary == 1000 
trace(2 << 2); // output: 8 

See also
>>= (bitwise right shift and assignment), >> (bitwise right shift), <<= (bitwise left shift and assignment), >>> (bitwise unsigned right shift), >>>= (bitwise unsigned right shift and assignment)

<<=

bitwise left shift and assignment Operator

Usage
expression1 <<= expression2

Player version: Flash Player 5

This operator performs a bitwise left shift (<<=) operation and stores the contents as a result in expression1. The following two expressions are equivalent:

A <<= B; 
A = (A << B)

Operands
expression1:Number — A number or expression to be shifted left.
expression2:Number — A number or expression that converts to an integer from 0 to 31.

Result
Number — The result of the bitwise operation.

Example
In the following example, you use the bitwise left shift and assignment (<<=) operator to shift all bits one space to the left:
var x:Number = 4; 
// shift all bits one slot to the left. 
x <<= 1; 
trace(x); // output: 8 
// 4 decimal = 0100 binary 
// 8 decimal = 1000 binary 

See also
<< (bitwise left shift), >>= (bitwise right shift and assignment), << (bitwise right shift)

~

bitwise NOT Operator

Usage
~expression

Player version: Flash Player 5

Also known as the one's complement operator or the bitwise complement operator. Converts the expression to a 32-bit signed integer, and then applies a bitwise one's complement. That is, every bit that is a 0 is set to 1 in the result, and every bit that is a 1 is set to 0 in the result. The result is a signed 32-bit integer.

For example, the hexadecimal value 0x7777 is represented as this binary number:
0111011101110111

The bitwise negation of that hexadecimal value, ~0x7777, is this binary number:
1000100010001000

In hexadecimal, this is 0x8888. Therefore, ~0x7777 is 0x8888.

The most common use of bitwise operators is for representing flag bits (Boolean values packed into 1 bit each).

Floating-point numbers are converted to integers by discarding any digits after the decimal point. Positive integers are converted to an unsigned hexadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hexadecimal value via the two's complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's complement with greater precision and also have the most significant digits discarded.

The return value is interpreted as a two's complement number with sign, so the return value is an integer in the range -2147483648 to 2147483647.

Operands
expression:Number — A number.

Result
Number — The result of the bitwise operation.

Example
The following example demonstrates a use of the bitwise NOT (-) operator with flag bits:
var ReadOnlyFlag:Number = 0x0001; // defines bit 0 as the read-only flag 
var flags:Number = 0; 
trace(flags); 
/* To set the read-only flag in the flags variable, 
   the following code uses the bitwise OR: 
*/
flags |= ReadOnlyFlag; 
trace(flags); 
/* To clear the read-only flag in the flags variable, 
   first construct a mask by using bitwise NOT on ReadOnlyFlag. 
   In the mask, every bit is a 1 except for the read-only flag. 
   Then, use bitwise AND with the mask to clear the read-only flag. 
   The following code constructs the mask and performs the bitwise AND: 
*/ 
flags &= ~ReadOnlyFlag; 
trace(flags); 
// output: 0 1 0 

See also
&(bitwise AND), &= (bitwise AND assignment), ^ (bitwise XOR), ^= (bitwise XOR assignment), | (bitwise OR), |= (bitwise OR assignment)

|

bitwise OR Operator

Usage
expression1 | expression2

Player version: Flash Player 5

Converts expression1 and expression2 to 32-bit unsigned integers, and returns a 1 in each bit position where the corresponding bits of either expression1 or expression2 are 1. Floating-point numbers are converted to integers by discarding any digits after the decimal point. The result is a new 32-bit integer.

Positive integers are converted to an unsigned hexadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hexadecimal value via the two's complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's complement with greater precision and also have the most significant digits discarded.

The return value is interpreted as a two's complement number with sign, so the return value will be an integer in the range -2147483648 to 2147483647.

Operands
expression1:Number — A number.
expression2:Number — A number.

Result
Number — The result of the bitwise operation.

Example
The following is an example of a bitwise OR (|) operation:
// 15 decimal = 1111 binary 
var x:Number = 15; 
// 9 decimal = 1001 binary 
var y:Number = 9; 
// 1111 | 1001 = 1111 
trace(x | y); // returns 15 decimal (1111 binary) 
Don't confuse the single | (bitwise OR) with || (logical OR).

See also
&(bitwise AND), &= (bitwise AND assignment), ^ (bitwise XOR), ^= (bitwise XOR assignment), |= (bitwise OR assignment), ~ (bitwise NOT)

|=

bitwise OR assignment Operator

Usage
expression1 |= expression2

Player version: Flash Player 5

Assigns expression1 the value of expression1 | expression2. For example, the following two statements are equivalent:

x |= y;
x = x | y; 

Operands
expression1:Number — A number or variable.
expression2:Number — A number or variable.

Result
Number — The result of the bitwise operation.

Example
The following example uses the bitwise OR assignment (|=) operator:
// 15 decimal = 1111 binary 
var x:Number = 15; 
// 9 decimal = 1001 binary 
var y:Number = 9; 
// 1111 |= 1001 = 1111 
trace(x |= y); // returns 15 decimal (1111 binary) 

See also
&(bitwise AND), &= (bitwise AND assignment), ^ (bitwise XOR), ^= (bitwise XOR assignment), | (bitwise OR), |= (bitwise OR assignment), ~ (bitwise NOT)

>>

bitwise right shift Operator

Usage
expression1 >> expression2

Player version: Flash Player 5

Converts expression1 and expression2 to 32-bit integers, and shifts all the bits in expression1 to the right by the number of places specified by the integer that results from the conversion of expression2 . Bits that are shifted off the right end are discarded. To preserve the sign of the original expression , the bits on the left are filled in with 0 if the most significant bit (the bit farthest to the left) of expression1 is 0, and filled in with 1 if the most significant bit is 1. Shifting a value right by one position is the equivalent of dividing by 2 and discarding the remainder.

Floating-point numbers are converted to integers by discarding any digits after the decimal point. Positive integers are converted to an unsigned hexadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hexadecimal value via the two's complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's complement with greater precision and also have the most significant digits discarded.

The return value is interpreted as a two's complement number with sign, so the return value will be an integer in the range -2147483648 to 2147483647.

Operands
expression1:Number — A number or expression to be shifted right.
expression2:Number — A number or expression that converts to an integer from 0 to 31.

Result
Number — The result of the bitwise operation.

Example
The following example converts 65535 to a 32-bit integer and shifts it 8 bits to the right:
var x:Number = 65535 >> 8; 
trace(x); // outputs 255
The following example shows the result of the previous example:
var x:Number = 255;
This is because 65535 decimal equals 1111111111111111 binary (sixteen 1s), 1111111111111111 binary shifted right by 8 bits is 11111111 binary, and 11111111 binary is 255 decimal. The most significant bit is 0 because the integers are 32-bit, so the fill bit is 0.

The following example converts -1 to a 32-bit integer and shifts it 1 bit to the right:

var x:Number = -1 >> 1;
trace(x); // outputs -1
The following example shows the result of the previous example:
var x:Number = -1;
This is because -1 decimal equals 11111111111111111111111111111111 binary (thirty-two 1s), shifting right by one bit causes the least significant (bit farthest to the right) to be discarded and the most significant bit to be filled in with 1. The result is 11111111111111111111111111111111 (thirty-two 1s) binary, which represents the 32-bit integer -1.

See also
>>= (bitwise right shift and assignment)

>>=

bitwise right shift and assignment Operator

Usage
expression1 >>= expression2

Player version: Flash Player 5

This operator performs a bitwise right-shift operation and stores the contents as a result in expression1.

The following two statements are equivalent:

A >>= B;  
A = (A >> B);

Operands
expression1:Number — A number or expression to be shifted right.
expression2:Number — A number or expression that converts to an integer from 0 to 31.

Result
Number — The result of the bitwise operation.

Example
The following commented code uses the bitwise right shift and assignment (>>=) operator.
function convertToBinary(numberToConvert:Number):String { 
    var result:String = ""; 
    for (var i = 0; i<32; i++) { 
        // Extract least significant bit using bitwise AND 
        var lsb:Number = numberToConvert & 1; 
        // Add this bit to the result 
        string result = (lsb ? "1" : "0")+result; 
        // Shift numberToConvert right by one bit, to see next bit 
        numberToConvert >>= 1; 
    } 
    return result; 
} 
trace(convertToBinary(479)); 
// Returns the string 00000000000000000000000111011111 
// This string is the binary representation of the decimal 
// number 479

See also
>> (bitwise right shift)

>>>

bitwise unsigned right shift Operator

Usage
expression1 >>> expression2

Player version: Flash Player 5

The same as the bitwise right shift (>>) operator except that it does not preserve the sign of the original expression because the bits on the left are always filled with 0.

Floating-point numbers are converted to integers by discarding any digits after the decimal point. Positive integers are converted to an unsigned hexadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hexadecimal value via the two's complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's complement with greater precision and also have the most significant digits discarded.

Operands
expression1:Number — A number or expression to be shifted right.
expression2:Number — A number or expression that converts to an integer between 0 and 31.

Result
Number — The result of the bitwise operation.

Example
The following example converts -1 to a 32-bit integer and shifts it 1 bit to the right:
var x:Number = -1 >>> 1; 
trace(x); // output: 2147483647 

This is because -1 decimal is 11111111111111111111111111111111 binary (thirty-two 1s), and when you shift right (unsigned) by 1 bit, the least significant (rightmost) bit is discarded, and the most significant (leftmost) bit is filled with a 0. The result is 01111111111111111111111111111111 binary, which represents the 32-bit integer 2147483647.

See also
>>= (bitwise right shift and assignment)

>>>=

bitwise unsigned right shift and assignment Operator

Usage
expression1 >>>= expression2

Player version: Flash Player 5

Performs an unsigned bitwise right-shift operation and stores the contents as a result in expression1. The following two statements are equivalent:

A >>>= B; 
A = (A >>> B); 

Operands
expression1:Number — A number or expression to be shifted right.
expression2:Number — A number or expression that converts to an integer from 0 to 31.

Result
Number — The result of the bitwise operation.

Example

See also
>>> (bitwise unsigned right shift), >>= (bitwise right shift and assignment)

^

bitwise XOR Operator

Usage
expression1 ^ expression2

Player version: Flash Player 5

Converts expression1 and expression2 to 32-bit unsigned integers, and returns a 1 in each bit position where the corresponding bits in expression1 or expression2, but not both, are 1. Floating-point numbers are converted to integers by discarding any digits after the decimal point. The result is a new 32-bit integer.

Positive integers are converted to an unsigned hexadecimal value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hexadecimal value via the two's complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's complement with greater precision and also have the most significant digits discarded.

The return value is interpreted as a two's complement number with sign, so the return value will be an integer in the range -2147483648 to 2147483647.

Operands
expression1:Number — A number.
expression2:Number — A number.

Result
Number — The result of the bitwise operation.

Example
The following example uses the bitwise XOR operator on the decimals 15 and 9, and assigns the result to the variable x:
// 15 decimal = 1111 binary 
// 9 decimal = 1001 binary 
var x:Number = 15 ^ 9; 
trace(x); 
// 1111 ^ 1001 = 0110 
// returns 6 decimal (0110 binary) 

See also
&(bitwise AND), &= (bitwise AND assignment), ^= (bitwise XOR assignment), | (bitwise OR), |= (bitwise OR assignment), ~ (bitwise NOT)

^=

bitwise XOR assignment Operator

Usage
expression1 ^= expression2

Player version: Flash Player 5

Assigns expression1 the value of expression1 ^ expression2. For example, the following two statements are equivalent:

x ^= y; 
x = x ^ y; 

Operands
expression1:Number — Integers and variables.
expression2:Number — Integers and variables.

Result
Number — The result of the bitwise operation.

Example
The following example shows a bitwise XOR assignment (^=) operation:
// 15 decimal = 1111 binary 
var x:Number = 15; 
// 9 decimal = 1001 binary 
var y:Number = 9; 
trace(x ^= y); // returns 6 decimal (0110 binary) 

See also
&(bitwise AND), &= (bitwise AND assignment), ^ (bitwise XOR), | (bitwise OR), |= (bitwise OR assignment), ~ (bitwise NOT)

/*..*/

block comment delimiter Operator

Usage
/* comment */
/* comment
   comment */

Player version: Flash Player 5

Indicates one or more lines of script comments. Any characters that appear between the opening comment tag (/*) and the closing comment tag (*/), are interpreted as a comment and ignored by the ActionScript interpreter. Use the // (comment delimiter) to identify single-line comments. Use the /* comment delimiter to identify comments on multiple successive lines. Leaving off the closing tag (*/) when using this form of comment delimiter returns an error message. Attempting to nest comments also returns an error message. After an opening comment tag (/*) is used, the first closing comment tag (*/) will end the comment, regardless of the number of opening comment tags (/*) placed between them.

Operands
comment — Any characters.

Example
The following script uses comment delimiters at the beginning of the script:
/* records the X and Y positions of 
the ball and bat movie clips */ 
var ballX:Number = ball_mc._x; 
var ballY:Number = ball_mc._y; 
var batX:Number = bat_mc._x; 
var batY:Number = bat_mc._y; 
The following attempt to nest comments will result in an error message:
/* this is an attempt to nest comments. 
/* But the first closing tag will be paired 
with the first opening tag */ 
and this text will not be interpreted as a comment */ 

See also
// (line comment delimiter)

,

comma Operator

Usage
(expression1 , expression2 [, expressionN... ])

Player version: Flash Player 4

Evaluates expression1, then expression2, and so on. This operator is primarily used with the for loop statement and is often used with the parentheses () operator.

Operands
expression1:Number — An expression to be evaluated.
expression2:Number — An expression to be evaluated.
expressionN:Number — Any number of additional expressions to be evaluated.

Result
Object — The value of expression1, expression2, and so on.

Example
The following example uses the comma (,) operator in a for loop:
for (i = 0, j = 0; i < 3 && j < 3; i++, j+=2) { 
    trace("i = " + i + ", j = " + j); 
} 
// Output: 
// i = 0, j = 0 
// i = 1, j = 2
The following example uses the comma (,) operator without the parentheses () operator and illustrates that the comma operator returns only the value of the first expression without the parentheses () operator:
var v:Number = 0; 
v = 4, 5, 6; 
trace(v); // output: 4 
The following example uses the comma (,) operator with the parentheses () operator and illustrates that the comma operator returns the value of the last expression when used with the parentheses () operator:
var v:Number = 0; 
v = (4, 5, 6); 
trace(v); // output: 6 
The following example uses the comma (,) operator without the parentheses () operator and illustrates that the comma operator sequentially evaluates all of the expressions but returns the value of the first expression. The second expression, z++, is evaluated and z is incremented by one.
var v:Number = 0; 
var z:Number = 0; 
v = v + 4 , z++, v + 6; 
trace(v); // output: 4 
trace(z); // output: 1 
The following example is identical to the previous example except for the addition of the parentheses () operator and illustrates once again that, when used with the parentheses () operator, the comma (,) operator returns the value of the last expression in the series:
var v:Number = 0; 
var z:Number = 0; 
v = (v + 4, z++, v + 6); 
trace(v); // output: 6 
trace(z); // output: 1 

See also
() (parentheses)

add

concatenation (strings) Operator

Deprecated since Flash Player 5 — Macromedia recommends that you use the add (+) operator when creating content for Flash Player 5 or later. This operator is not supported in Flash Player 8 or later.

Usage
string1 add string2

Player version: Flash Player 4

Concatenates two or more strings. The add (+) operator replaces the Flash 4 & operator; Flash Player 4 files that use the & operator are automatically converted to use the add (+) operator for string concatenation when brought into the Flash 5 or later authoring environment. Use the add (+) operator to concatenate strings if you are creating content for Flash Player 4 or earlier versions of the Player.

Operands
string1:String — A string.
string2:String — A string.

Result
String — The concatenated string.

See also
+ (addition)

?:

conditional Operator

Usage
expression1 ? expression2 : expression3

Player version: Flash Player 4

Instructs Flash to evaluate expression1, and if the value of expression1 is true, it returns the value of expression2; otherwise it returns the value of expression3.

Operands
expression1:Object — An expression that evaluates to a Boolean value; usually a comparison expression, such as x < 5.
expression2:Object — Values of any type.
expression3:Object — Values of any type.

Result
Object — The value of expression2 or expression3.

Example
The following statement assigns the value of variable x to variable z because expression1 evaluates to true:
var x:Number = 5; 
var y:Number = 10; 
var z = (x < 6) ? x: y; 
trace (z); // returns 5
The following example shows a conditional statement written in shorthand:
var timecode:String = (new Date().getHours() < 11) ? "AM" : "PM"; 
trace(timecode); 
The same conditional statement could also be written in longhand, as shown in the following example:
if (new Date().getHours() < 11) { 
    var timecode:String = "AM"; 
} else { 
    var timecode:String = "PM"; 
} trace(timecode); 


--

decrement Operator

Usage
--expression
expression--

Player version: Flash Player 4

A pre-decrement and post-decrement unary operator that subtracts 1 from the expression . The expression can be a variable, element in an array, or property of an object. The pre-decrement form of the operator (--expression) subtracts 1 from expression and returns the result. The post-decrement form of the operator (expression--) subtracts 1 from the expression and returns the initial value of expression (the value prior to the subtraction).

Operands
expression:Number — A number or a variable that evaluates to a number.

Result
Number — The result of the decremented value.

Example
The pre-decrement form of the operator decrements x to 2 ( x - 1 = 2) and returns the result as y:
var x:Number = 3; 
var y:Number = --x; //y is equal to 2
The post-decrement form of the operator decrements x to 2 (x - 1 = 2 ) and returns the original value of x as the result y:
var x:Number = 3; 
var y:Number = x--; //y is equal to 3
The following example loops from 10 to 1, and each iteration of the loop decreases the counter variable i by 1.
for (var i = 10; i>0; i--) { 
    trace(i); 
}


/

division Operator

Usage
expression1 / expression2

Player version: Flash Player 4

Divides expression1 by expression2. The result of the division operation is a double-precision floating-point number.

Operands
expression:Number — A number or a variable that evaluates to a number.

Result
Number — The floating-point result of the operation.

Example
The following statement divides the current width and height of the Stage, and then displays the result in the Output panel. The following statement divides the current width and height of the Stage and then writes the result to the log file.
trace(Stage.width/2); 
trace(Stage.height/2); 
For a default Stage width and height of 550 x 400, the output is 275 and 150.

See also
% (modulo)

/=

division assignment Operator

Usage
expression1 /= expression2

Player version: Flash Player 4

Assigns expression1 the value of expression1 / expression2. For example, the following two statements are equivalent:

x /= y;
x = x / y;

Operands
expression1:Number — A number or a variable that evaluates to a number.
expression2:Number — A number or a variable that evaluates to a number.

Result
Number — A number.

Example
The following code illustrates using the division assignment (/=) operator with variables and numbers:
var x:Number = 10; 
var y:Number = 2; 
x /= y; trace(x); // output: 5 

See also
/ (division)

.

dot Operator

Usage
object.property_or_method
instancename.variable
instancename.childinstance
instancename.childinstance.variable

Player version: Flash Player 4

Used to navigate movie clip hierarchies to access nested (child) movie clips, variables, or properties. The dot operator is also used to test or set the properties of an object or top-level class, execute a method of an object or top-level class, or create a data structure.

Operands
object:Object — An instance of a class. The object can be an instance of any of the built-in ActionScript classes or a custom class. This parameter is always to the left of the dot (.) operator.
property_or_method — The name of a property or method associated with an object. All the valid methods and properties for the built-in classes are listed in the method and property summary tables for that class. This parameter is always to the right of the dot (.) operator.
instancename:MovieClip — The instance name of a movie clip.
variable — The instance name to the left of the dot (.) operator can also represent a variable on the Timeline of the movie clip.
childinstance:MovieClip — A movie clip instance that is a child of, or nested in, another movie clip.

Result
Object — The method, property or movie clip named on the right side of the dot.

Example
The following example identifies the current value of the variable hairColor in the movie clip person_mc:
person_mc.hairColor 
The Flash 4 authoring environment did not support dot syntax, but Flash MX 2004 files published for Flash Player 4 can use the dot operator. The preceding example is equivalent to the following (deprecated) Flash 4 syntax:
/person_mc:hairColor 
The following example creates a new movie clip within the _root scope. Then a text field is created inside the movie clip called container_mc. The text field's autoSize property is set to true and then populated with the current date.
this.createEmptyMovieClip("container_mc", this.getNextHighestDepth()); 
this.container_mc.createTextField("date_txt", this.getNextHighestDepth(), 0, 0, 100, 22); 
this.container_mc.date_txt.autoSize = true; 
this.container_mc.date_txt.text = new Date(); 
The dot (.) operator is used when targeting instances within the SWF file and when you need to set properties and values for those instances.


==

equality Operator

Usage
expression1 == expression2

Player version: Flash Player 5

Tests two expressions for equality. The result is true if the expressions are equal.

The definition of equal depends on the data type of the parameter:

When comparing by value, if expression1 and expression2 are different data types, ActionScript will attempt to convert the data type of expression2 to match that of expression1.

Operands
expression1:Object — A number, string, Boolean value, variable, object, array, or function.
expression2:Object — A number, string, Boolean value, variable, object, array, or function.

Result
Boolean — The Boolean result of the comparison.

Example
The following example uses the equality (==) operator with an if statement:
var a:String = "David", b:String = "David"; 
if (a == b) { 
    trace("David is David"); 
} 
The following examples show the results of operations that compare mixed types:
var x:Number = 5; 
var y:String = "5"; 
trace(x == y); // output: true 
var x:String = "5"; 
var y:String = "66"; 
trace(x == y); // output: false 
var x:String = "chris"; 
var y:String = "steve"; 
trace(x == y); // output: false 
The following examples show comparison by reference. The first example compares two arrays with identical length and elements. The equality operator will return false for these two arrays. Although the arrays appear equal, comparison by reference requires that they both refer to the same array. The second example creates the thirdArray variable, which points to the same array as the variable firstArray. The equality operator will return true for these two arrays because the two variables refer to the same array.
var firstArray:Array = new Array("one", "two", "three"); 
var secondArray:Array = new Array("one", "two", "three"); 
trace(firstArray == secondArray); 
// will output false 
// Arrays are only considered equal 
// if the variables refer to the same array. 
var thirdArray:Array = firstArray; 
trace(firstArray == thirdArray); // will output true 

See also
! (logical NOT), != (inequality), !== (strict inequality), && (logical AND), || (logical OR), === (strict equality)

eq

equality (strings) Operator

Deprecated since Flash Player 5 — This operator was deprecated in favor of the == (equality) operator.

Usage
expression1 eq expression2

Player version: Flash Player 4

Compares two expressions for equality and returns a value of true if the string representation of expression1 is equal to the string representation of expression2, false otherwise.

Operands
expression1:Object — Numbers, strings, or variables.
expression2:Object — Numbers, strings, or variables.

Result
Boolean — The result of the comparison.

See also
== (equality)

>

greater than Operator

Usage
expression1 > expression2

Player version: Flash Player 4 — In Flash 4, > is a numeric operator. In Flash 5 or later, the greater-than (>) operator is a comparison operator capable of handling various data types. Flash 4 files that are brought into the Flash 5 or later authoring environment undergo a conversion process to maintain data type integrity. The following illustrates the conversion of a Flash 4 file containing a numeric quality comparison. Flash 4 file: x > y Converted Flash 5 or later file: Number(x) > Number(y)

Compares two expressions and determines whether expression1 is greater than expression2; if it is, the operator returns true. If expression1 is less than or equal to expression2, the operator returns false. String expressions are evaluated using alphabetical order; all capital letters come before lowercase letters.

Operands
expression1:Object — A number or string.
expression2:Object — A number or string.

Result
Boolean — The Boolean result of the comparison.

Example
In the following example, the greater than (>) operator is used to determine whether the value of the text field score_txt is greater than 90:
if (score_txt.text>90) { 
    trace("Congratulations, you win!"); 
} else { 
    trace("sorry, try again"); 
} 


gt

greater than (strings) Operator

Deprecated since Flash Player 5 — This operator was deprecated in favor of the > (greater than) operator.

Usage
expression1 gt expression2

Player version: Flash Player 4

Compares the string representation of expression1 with the string representation of expression2 and returns true if expression1 is greater than expression2, false otherwise.

Operands
expression1:Object — Numbers, strings, or variables.
expression2:Object — Numbers, strings, or variables.

Result
Boolean — The Boolean result of the comparison.

See also
> (greater than)

>=

greater than or equal to Operator

Usage
expression1 >= expression2

Player version: Flash Player 4 — In Flash 4, >= is a numeric operator. In Flash 5 or later, the greater than or equal to (>=) operator is a comparison operator capable of handling various data types. Flash 4 files that are brought into the Flash 5 or later authoring environment undergo a conversion process to maintain data type integrity. The following illustrates the conversion of a Flash 4 file containing a numeric quality comparison. Flash 4 file: x >= y Converted Flash 5 or later file: Number(x) >= Number(y)

Compares two expressions and determines whether expression1 is greater than or equal to expression2 (true) or expression1 is less than expression2 (false).

Operands
expression1:Object — A string, integer, or floating-point number.
expression2:Object — A string, integer, or floating-point number.

Result
Boolean — The Boolean result of the comparison.

Example
In the following example, the greater than or equal to (>=) operator is used to determine whether the current hour is greater than or equal to 12:
if (new Date().getHours() >= 12) { 
    trace("good afternoon"); 
} else { 
    trace("good morning"); 
}


ge

greater than or equal to (strings) Operator

Deprecated since Flash Player 5 — This operator was deprecated in favor of the >= (greater than or equal to) operator.

Usage
expression1 ge expression2

Player version: Flash Player 4

Compares the string representation of expression1 with the string representation of expression2 and returns true if expression1 is greater than or equal to expression2, false otherwise.

Operands
expression1:Object — Numbers, strings, or variables.
expression2:Object — Numbers, strings, or variables.

Result
Boolean — The result of the comparison.

See also
>= (greater than or equal to)

++

increment Operator

Usage
++expression
expression++

Player version: Flash Player 4

A pre-increment and post-increment unary operator that adds 1 to expression . The expression can be a variable, element in an array, or property of an object. The pre-increment form of the operator (++expression) adds 1 to expression and returns the result. The post-increment form of the operator (expression++ ) adds 1 to expression and returns the initial value of expression (the value prior to the addition).

The pre-increment form of the operator increments x to 2 (x + 1 = 2) and returns the result as y:

var x:Number = 1; 
var y:Number = ++x; 
trace("x:"+x); //traces x:2 
trace("y:"+y); //traces y:2
The post-increment form of the operator increments x to 2 (x + 1 = 2) and returns the original value of x as the result y:
var x:Number = 1; 
var y:Number = x++; 
trace("x:"+x); //traces x:2 
trace("y:"+y); //traces y:1

Operands
expression:Number — A number or a variable that evaluates to a number.

Result
Number — The result of the increment.

Example
The following example uses ++ as a post-increment operator to make a while loop run five times:
var i:Number = 0; 
while (i++ < 5) { 
    trace("this is execution " + i); 
} 
/* output: 
   this is execution 1 
   this is execution 2 
   this is execution 3 
   this is execution 4 
   this is execution 5 
*/
The following example uses ++ as a pre-increment operator:
var a:Array = new Array(); 
var i:Number = 0; 
while (i < 10) { 
    a.push(++i); 
} 
trace(a.toString()); //traces: 1,2,3,4,5,6,7,8,9,10 
This example also uses ++ as a pre-increment operator.
var a:Array = []; 
for (var i = 1; i <= 10; ++i) { 
    a.push(i); 
} 
trace(a.toString()); //traces: 1,2,3,4,5,6,7,8,9,10 
This script shows the following result in the Output panel: This script writes the following result to the log file: 1,2,3,4,5,6,7,8,9,10 The following example uses ++ as a post-increment operator in a while loop:
// using a while loop 
var a:Array = new Array(); 
var i:Number = 0; 
while (i < 10) { 
    a.push(i++); 
} 
trace(a.toString()); //traces 0,1,2,3,4,5,6,7,8,9 
The following example uses ++ as a post-increment operator in a for loop:
// using a for loop 
var a:Array = new Array(); 
for (var i = 0; i < 10; i++) { 
    a.push(i); 
} 
trace(a.toString()); //traces 0,1,2,3,4,5,6,7,8,9 
This script displays the following result in the Output panel: This script writes the following result to the log file:
0,1,2,3,4,5,6,7,8,9 


!=

inequality Operator

Usage
expression1 != expression2

Player version: Flash Player 5

Tests for the exact opposite of the equality ( ==) operator. If expression1 is equal to expression2 , the result is false. As with the equality (==) operator, the definition o