Bitwise Not Operator - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Returns
- The result of the bitwise operation.
Number
Example
In the following example, you use the bitwise left shift and assignment (
) operator to shift
<<=
all bits one space to the left:
var x:Number = 4;
// shift all bits one slot to the left.
x <<= 1;
trace(x); // output: 8
// 4 decimal = 0100 binary
// 8 decimal = 1000 binary
See also
,
<< bitwise left shift operator
>>= bitwise right shift and assignment
,
operator
>> bitwise right shift operator

~ bitwise NOT operator

~expression
Also known as the one's complement operator or the bitwise complement operator. Converts
the
to a 32-bit signed integer, and then applies a bitwise one's complement. That
expression
is, every bit that is a 0 is set to 1 in the result, and every bit that is a 1 is set to 0 in the result.
The result is a signed 32-bit integer.
For example, the hexadecimal value 0x7777 is represented as this binary number:
0111011101110111
The bitwise negation of that hexadecimal value, ~0x7777, is this binary number:
1000100010001000
In hexadecimal, this is 0x8888. Therefore, ~0x7777 is 0x8888.
The most common use of bitwise operators is for representing flag bits (Boolean values packed
into 1 bit each).
142
ActionScript language elements

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF