When you use operands, you need to be careful of the order. This is particularly the case when
you use complex conditions. In the following snippet, you can see how you use the logical
AND operator to check that a number is between 10 and 20. Based on the result, you display
an appropriate message. If the number is less than 10 or greater than 20, an alternate message
is displayed in the Output panel.
submit_mc.onRelease = function():Void {
var myNum:Number = Number(myTxt.text);
if (isNaN(myNum)) {
trace("Please enter a number");
return;
}
if ((myNum > 10) && (myNum < 20)) {
trace("Your number is between 10 and 20");
} else {
trace("Your number is NOT between 10 and 20");
}
};
About bitwise shift operators
The bitwise shift operators take two operands and shift the bits of the first operand to the
extent specified by the second operand. All of the operators in this table have equal
precedence:
Operator
Operation performed
Bitwise left shift
<<
Bitwise right shift
>>
Bitwise unsigned right shift
>>>
For information on using bitwise operators, see
specific information on each bitwise operator, see its entry in the ActionScript 2.0 Language
Reference.
196
Syntax and Language Fundamentals
"Using bitwise operators" on page
197. For
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?