Flash CS4 Professional ActionScript 2.0

Operators

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

Operators summary

Operator

Description

+ ( addition)

Adds numeric expressions or concatenates (combines) strings.

+= ( addition assignment)

Assigns expression1 the value of expression1 + expression2.

[] ( array access)

Initializes a new array or multidimensional array with the specified elements (a0 , and so on), or accesses elements in an array.

= ( assignment)

Assigns the value of expression2 (the parameter on the right) to the variable, array element, or property in expression1.

& ( bitwise AND)

Converts expression1 and expression2 to 32-bit unsigned integers, and performs a Boolean AND operation on each bit of the integer parameters.

&= ( bitwise AND assignment)

Assigns expression1 the value of expression1& expression2.

<< ( bitwise left shift)

Converts 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 left shift and assignment)

This operator performs a bitwise left shift (<<=) operation and stores the contents as a result in expression1.

~ ( bitwise NOT)

Also known as the one's complement operator or the bitwise complement operator.

| ( bitwise OR)

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.

|= ( bitwise OR assignment)

Assigns expression1 the value of expression1 | expression2.

>> ( bitwise right shift)

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.

>>= ( bitwise right shift and assignment)

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

>>> ( bitwise unsigned right shift)

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.

>>>= ( bitwise unsigned right shift and assignment)

Performs an unsigned bitwise right-shift operation and stores the contents as a result in expression1.

^ ( bitwise XOR)

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.

^= ( bitwise XOR assignment)

Assigns expression1 the value of expression1 ^ expression2.

/*..*/ ( block comment delimiter)

Indicates one or more lines of script comments.

, ( comma)

Evaluates expression1 , then expression2 , and so on.

add ( concatenation (strings))

Deprecated since Flash Player 5. Adobe 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.

Concatenates two or more strings.

?: ( conditional)

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.

-- ( decrement)

A pre-decrement and post-decrement unary operator that subtracts 1 from the expression.

/ ( division)

Divides expression1 by expression2.

/= ( division assignment)

Assigns expression1 the value of expression1 / expression2.

. ( dot)

Used to navigate movie clip hierarchies to access nested (child) movie clips, variables, or properties.

== ( equality)

Tests two expressions for equality.

eq ( equality (strings))

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

Returns true if the string representation of expression1 is equal to the string representation of expression2, false otherwise.

> ( greater than)

Compares two expressions and determines whether expression1 is greater than expression2; if it is, the operator returns true.

gt ( greater than (strings))

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

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

>= ( greater than or equal to)

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

ge ( greater than or equal to (strings))

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

Returns true if expression1 is greater than or equal to expression2, false otherwise.

++ ( increment)

A pre-increment and post-increment unary operator that adds 1 to expression .

!= ( inequality)

Tests for the exact opposite of the equality (== ) operator.

<> ( inequality)

Deprecated since Flash Player 5. This operator has been deprecated. Adobe recommends that you use the != (inequality) operator.

Tests for the exact opposite of the equality (==) operator.

instanceof

Tests whether object is an instance of classConstructor or a subclass of classConstructor.

< ( less than)

Compares two expressions and determines whether expression1 is less than expression2 ; if so, the operator returns true.

lt ( less than (strings))

Deprecated since Flash Player 5. This operator was deprecated in favor of the < (less than) operator.

Returns true if expression1 is less than expression2, false otherwise.

<= ( less than or equal to)

Compares two expressions and determines whether expression1 is less than or equal to expression2 ; if it is, the operator returns true.

le ( less 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.

Returns true if expression1 is less than or equal to expression2, false otherwise.

// ( line comment delimiter)

Indicates the beginning of a script comment.

&& ( logical AND)

Performs a Boolean operation on the values of both expressions.

and ( logical AND)

Deprecated since Flash Player 5. Adobe recommends that you use the logical AND (&&) operator.

Performs a logical AND (&&) operation in Flash Player 4.

! ( logical NOT)

Inverts the Boolean value of a variable or expression.

not ( logical NOT)

Deprecated since Flash Player 5. This operator was deprecated in favor of the! (logical NOT) operator.

Performs a logical NOT (!) operation in Flash Player 4.

|| ( logical OR)

Evaluates expression1 (the expression on the left side of the operator) and returns true if the expression evaluates to true.

or ( logical OR)

Deprecated since Flash Player 5. This operator was deprecated in favor of the || (logical OR) operator.

Evaluates condition1 and condition2, and if either expression is true, the whole expression is true.

% ( modulo)

Calculates the remainder of expression1 divided by expression2.

%= ( modulo assignment)

Assigns expression1 the value of expression1 % expression2.

* ( multiplication)

Multiplies two numerical expressions.

*= ( multiplication assignment)

Assigns expression1 the value of expression1 * expression2.

new

Creates a new, initially anonymous, object and calls the function identified by the constructor parameter.

ne ( not equal (strings))

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

Returns true if expression1 is not equal to expression2; false otherwise.

{} ( object initializer)

Creates a new object and initializes it with the specified name and value property pairs.

() ( parentheses)

Performs 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.

=== ( strict equality)

Tests 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 inequality)

Tests for the exact opposite of the strict equality ( === ) operator.

" ( string delimiter)

When 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.

- ( subtraction)

Used for negating or subtracting.

-= ( subtraction assignment)

Assigns expression1 the value of expression1 - expression2.

: ( type)

Used for strict data typing; this operator specifies the variable type, function return type, or function parameter type.

typeof

The typeof operator evaluate the expression and returns a string specifying whether the expression is a String, MovieClip, Object, Function, Number, or Boolean value.

void

The void operator evaluates an expression and then discards its value, returning undefined