Using operators to manipulate values in expressions
35
The following table lists the ActionScript comparison operators:
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,"
to
"Donna!"
:
"Congratulations, " + "Donna!"
The result is
"Congratulations, Donna!"
If only one of the addition (
+
) operator’s operands is
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
>
,
>=
,
<
, and
<=
also have a special effect when operating on strings.
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.
Operator
Operation performed
<
Less than: Returns
true
if the left operand is mathematically smaller than the right
operand.
Returns
true
if the left operand alphabetically precedes the right operand (for
example, a < b).
>
Greater than: Returns
true
if the left operand is mathematically larger than the right
operand.
Returns
true
if the left operand alphabetically follows the right operand (for example,
b > a).
<=
Less than or equal to: Returns
true
if the left operand is mathematically smaller than
or the same as the right operand.
Returns
true
if the left operand alphabetically precedes or is the same as the right
operand.
>=
Greater than or equal to: Returns
true
if the left operand is mathematically larger than
or the same as the right operand.
Returns
true
if the left operand alphabetically follows or is the same as the right
operand.
<>
!=
Not equal: Returns
true
if the operands are not mathematically equivalent.
Returns
true
if the operands are not the same.
==
Equality: Tests two expressions for equality. The result is
true
if the expressions are
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
true
if both expressions, including their data types, are equal. Does not apply to
strings.
Содержание FLEX-FLEX ACTIONSCRIPT LANGUAGE
Страница 1: ...Flex ActionScript Language Reference...
Страница 8: ......
Страница 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Страница 76: ......
Страница 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Страница 135: ...case 135 See also break default strict equality switch...
Страница 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Страница 229: ...while 229 i 3 The following result is written to the log file 0 3 6 9 12 15 18 See also do while continue for for in...
Страница 808: ...808 Chapter 7 ActionScript for Flash...
Страница 810: ...810 Appendix A Deprecated Flash 4 operators...
Страница 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Страница 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Страница 822: ...822 Index...