03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

^ bitwise XOR 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 in expression1 or expression2, but not both, are<br />

1. 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 hex 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 hex value via the two's complement notation, with the minimum<br />

being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's<br />

complement with greater precision <strong>and</strong> also have the most significant digits 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 />

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

expression1 : Number - A number.<br />

expression2 : Number - A number.<br />

Returns<br />

Number - The result of the bitwise operation.<br />

Example<br />

The following example uses the bitwise XOR operator on the decimals 15 <strong>and</strong> 9, <strong>and</strong> assigns<br />

the result to the variable x:<br />

// 15 decimal = 1111 binary<br />

// 9 decimal = 1001 binary<br />

var x:Number = 15 ^ 9;<br />

trace(x);<br />

// 1111 ^ 1001 = 0110<br />

// returns 6 decimal (0110 binary)<br />

See also<br />

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

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

~ bitwise NOT operator<br />

Operators 127

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

Saved successfully!

Ooh no, something went wrong!