About bitwise logical operators
The bitwise logical operators take two operands and perform bit-level logical operations. The
bitwise logical operators differ in precedence and are listed in the table in order of decreasing
precedence:
Operator
Operation performed
Bitwise AND
&
Bitwise XOR
^
Bitwise OR
|
For information on using bitwise operators, see
specific information on each bitwise operator, see its entry in the ActionScript 2.0 Language
Reference.
Using bitwise operators
Bitwise operators internally manipulate floating-point numbers to change them into 32-bit
integers. The exact operation performed depends on the operator, but all bitwise operations
evaluate each binary digit (bit) of the 32-bit integer individually to compute a new value. For
a list of bitwise shift operators, see
bitwise logical operators, see
Using bitwise operators in Flash isn't very common, but can be useful in some circumstances.
For example, you might want to build a permissions matrix for a Flash project, but you don't
want to create separate variables for each type of permission. In this case, you might use
bitwise operators.
The following example shows how you can use the bitwise OR operator with the
method to specify sort options.
Array.sort()
To use the bitwise OR operator:
1.
Select File > New and create a new Flash document.
2.
Type the following ActionScript into the Actions panel:
var myArr:Array = new Array("Bob", "Dan", "doug", "bill", "Hank",
"tom");
trace(myArr); // Bob,Dan,doug,bill,Hank,tom
myArr.sort(Array.CASEINSENSITIVE | Array.DESCENDING);
trace(myArr); // tom,Hank,doug,Dan,Bob,bill
"Using bitwise operators" on page
"About bitwise shift operators" on page
"About bitwise logical operators" on page
197. For
196. For a list of
197.
About operators
197
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?