MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference page 129

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

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).
Floating-point numbers are converted to integers by discarding any digits after the decimal
point. Positive integers are converted to an unsigned hex value with a maximum value of
4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant
digits discarded when they are converted so the value is still 32-bit. Negative numbers are
converted to an unsigned hex value via the two's complement notation, with the minimum
being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's
complement with greater precision and also have the most significant digits discarded.
The return value is interpreted as a two's complement number with sign, so the return value is
an integer in the range -2147483648 to 2147483647.
Availability: ActionScript 1.0; Flash Lite 2.0
Operands
expression :
Number
Returns
- The result of the bitwise operation.
Number
Example
The following example demonstrates a use of the bitwise NOT (-) operator with flag bits:
var ReadOnlyFlag:Number = 0x0001; // defines bit 0 as the read-only flag
var flags:Number = 0;
trace(flags);
/* To set the read-only flag in the flags variable,
the following code uses the bitwise OR:
*/
flags |= ReadOnlyFlag;
trace(flags);
/* To clear the read-only flag in the flags variable,
first construct a mask by using bitwise NOT on ReadOnlyFlag.
In the mask, every bit is a 1 except for the read-only flag.
Then, use bitwise AND with the mask to clear the read-only flag.
The following code constructs the mask and performs the bitwise AND:
*/
flags &= ~ReadOnlyFlag;
trace(flags);
// output: 0 1 0
- A number.
Operators
129

Advertisement

Table of Contents
loading

Table of Contents