EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Bitwise and Assignment Operator

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Operators 139
Operands
expression1 : Number - A number.
expression2 : Number - A number.
Returns
Number - The result of the bitwise operation.
Example
The following example compares the bit representation of the numbers and returns 1 only if
both bits at the same position are 1. In this ActionScript, you add 13 (binary 1101) and 11
(binary 1011) and return 1 only in the position where both numbers have a 1.
var insert:Number = 13;
var update:Number = 11;
trace(insert & update); // output : 9 (or 1001 binary)
In the numbers 13 and 11 the result is 9 because only the first and last positions in both
numbers have the number 1.
The following examples show the behavior of the return value conversion:
trace(0xFFFFFFFF); // 4294967295
trace(0xFFFFFFFF & 0xFFFFFFFF); // -1
trace(0xFFFFFFFF & -1); // -1
trace(4294967295 & -1); // -1
trace(4294967295 & 4294967295); // -1
See also
&= bitwise AND assignment operator, ^ bitwise XOR operator, ^= bitwise XOR
assignment operator
, | bitwise OR operator, |= bitwise OR assignment operator,
~ bitwise NOT operator
&= bitwise AND assignment operator
expression1 &= expression2
Assigns expression1 the value of expression1& expression2. For example, the following
two expressions are equivalent:
x &= y;
x = x & y;
Availability: ActionScript 1.0; Flash Player 5

Table of Contents

Related product manuals