Bitwise And Assignment Operator - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Operands
expression1 : Number
expression2 : Number
Returns
- The result of the bitwise operation.
Number
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
assignment operator
~ bitwise NOT operator
&= bitwise AND assignment operator
expression1 &= expression2
Assigns
expression1
two expressions are equivalent:
x &= y;
x = x & y;
Availability: ActionScript 1.0; Flash Player 5
- A number.
- A number.
,
,
| bitwise OR operator
the value of
expression1& expression2
^ bitwise XOR operator
,
|= bitwise OR assignment operator
,
^= bitwise XOR
. For example, the following
Operators
,
139

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF