196
Syntax and Language Fundamentals
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:
For information on using bitwise operators, see
“Using bitwise operators” on page 197
. For
specific information on each bitwise operator, see its entry in the
ActionScript 2.0 Language
Reference
.
Operator
Operation performed
<<
Bitwise left shift
>>
Bitwise right shift
>>>
Bitwise unsigned right shift
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...