03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

* To set the read-only flag in the flags variable,<br />

the following code uses the bitwise OR:<br />

*/<br />

flags |= ReadOnlyFlag;<br />

trace(flags);<br />

/* To clear the read-only flag in the flags variable,<br />

first construct a mask by using bitwise NOT on ReadOnlyFlag.<br />

In the mask, every bit is a 1 except for the read-only flag.<br />

Then, use bitwise AND with the mask to clear the read-only flag.<br />

The following code constructs the mask <strong>and</strong> performs the bitwise AND:<br />

*/<br />

flags &= ~ReadOnlyFlag;<br />

trace(flags);<br />

// output: 0 1 0<br />

See also<br />

& bitwise AND operator, &= bitwise AND assignment operator, ^ bitwise XOR<br />

operator, ^= bitwise XOR assignment operator, | bitwise OR operator, |=<br />

bitwise OR assignment operator<br />

| bitwise OR operator<br />

expression1 | expression2<br />

Converts expression1 <strong>and</strong> expression2 to 32-bit unsigned integers, <strong>and</strong> returns a 1 in each<br />

bit position where the corresponding bits of either expression1 or expression2 are 1.<br />

Floating-point numbers are converted to integers by discarding any digits after the decimal<br />

point. The result is a new 32-bit integer.<br />

Positive integers are converted to an unsigned hexadecimal value with a maximum value of<br />

4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant<br />

digits discarded when they are converted so the value is still 32-bit. Negative numbers are<br />

converted to an unsigned hexadecimal value via the two's complement notation, with the<br />

minimum being -2147483648 or 0x800000000; numbers less than the minimum are<br />

converted to two's complement with greater precision <strong>and</strong> also have the most significant digits<br />

discarded.<br />

The return value is interpreted as a two's complement number with sign, so the return value<br />

will be an integer in the range -2147483648 to 2147483647.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5<br />

Oper<strong>and</strong>s<br />

expression1 : Number - A number.<br />

expression2 : Number - A number.<br />

148 <strong>ActionScript</strong> language elements

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!