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.

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

expression1 : Number - A number or expression to be shifted right.<br />

expression2 : Number - A number or expression that converts to an integer between 0 <strong>and</strong><br />

31.<br />

Returns<br />

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

Example<br />

The following example converts -1 to a 32-bit integer <strong>and</strong> shifts it 1 bit to the right:<br />

var x:Number = -1 >>> 1;<br />

trace(x); // output: 2147483647<br />

This is because -1 decimal is 11111111111111111111111111111111 binary (thirty-two 1s),<br />

<strong>and</strong> when you shift right (unsigned) by 1 bit, the least significant (rightmost) bit is discarded,<br />

<strong>and</strong> the most significant (leftmost) bit is filled with a 0. The result is<br />

01111111111111111111111111111111 binary, which represents the 32-bit integer<br />

2147483647.<br />

See also<br />

>>= bitwise right shift <strong>and</strong> assignment operator<br />

>>>= bitwise unsigned right shift <strong>and</strong> assignment<br />

operator<br />

expression1 >>>= expression2<br />

Performs an unsigned bitwise right-shift operation <strong>and</strong> stores the contents as a result in<br />

expression1. The following two statements are equivalent:<br />

A >>>= B;<br />

A = (A >>> B);<br />

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

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

expression1 : Number - A number or expression to be shifted right.<br />

expression2 : Number - A number or expression that converts to an integer from 0 to 31.<br />

Returns<br />

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

Operators 153

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

Saved successfully!

Ooh no, something went wrong!