The following table lists the ActionScript comparison operators:
Operator
Operation performed
Less than: Returns
<
operand.
Returns
example, a < b).
Greater than: Returns
>
operand.
Returns
b > a).
<=
Less than or equal to: Returns
or the same as the right operand.
Returns
operand.
Greater than or equal to: Returns
>=
or the same as the right operand.
Returns
operand.
<>
Not equal: Returns
!=
Returns
==
Equality: Tests two expressions for equality. The result is
equal.
===
Strict equality: Tests two expressions for equality; the strict equality operator performs
the same as the equality operator except that data types are not converted. The result
is
strings.
String operators
The addition (+) operator has a special effect when it operates on strings: It concatenates the two
string operands. For example, the following statement adds
"Congratulations, " + "Donna!"
The result is
"Congratulations, Donna!"
a string, Flash converts the other operand to a string. ActionScript treats spaces at the beginning
or end of a string as a literal part of the string.
The comparison operators
These operators compare two strings to determine which is first in alphabetical order.
The comparison operators compare strings only if both operands are strings. If only one of
the operands is a string, ActionScript converts both operands to numbers and performs a
numeric comparison. Uppercase characters precede lowercase in alphabetic order, so "Eagle"
comes before "dog." If you want to compare two strings or characters regardless of case, you need
to convert both strings to upper- or lowercase before comparing them.
if the left operand is mathematically smaller than the right
true
if the left operand alphabetically precedes the right operand (for
true
true
if the left operand alphabetically follows the right operand (for example,
true
if the left operand alphabetically precedes or is the same as the right
true
if the left operand alphabetically follows or is the same as the right
true
if the operands are not mathematically equivalent.
true
if the operands are not the same.
true
if both expressions, including their data types, are equal. Does not apply to
true
,
,
, and
>
>=
<
if the left operand is mathematically larger than the right
if the left operand is mathematically smaller than
true
if the left operand is mathematically larger than
true
"Congratulations,"
If only one of the addition (
also have a special effect when operating on strings.
<=
Using operators to manipulate values in expressions
if the expressions are
true
to
"Donna!"
) operator's operands is
+
:
35
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?