EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Page 143

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 143
Floating-point numbers are converted to integers by discarding any digits after the decimal
point. Positive integers are converted to an unsigned hexadecimal 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 hexadecimal 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 Player 5
Operands
expression : Number - A number.
Returns
Number - The result of the bitwise operation.
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
See also
& bitwise AND operator, &= bitwise AND assignment operator, ^ bitwise XOR
operator
, ^= bitwise XOR assignment operator, | bitwise OR operator, |=
bitwise OR assignment operator

Table of Contents

Related product manuals