The following two expressions are equivalent:
A >>= B
A = (A >> B)
For more information, see
Example
The following commented code uses the bitwise right shift and assignment (
function convertToBinary(numberToConvert:Number):String {
var result:String = "";
for (var i = 0; i<32; i++) {
// Extract least significant bit using bitwise AND
var lsb:Number = numberToConvert & 1;
// Add this bit to the result string
result = (lsb ? "1" : "0")+result;
// Shift numberToConvert right by one bit, to see next bit
numberToConvert >>= 1;
}
return result;
}
trace(convertToBinary(479));
// Returns the string 00000000000000000000000111011111
// This string is the binary representation of the decimal
// number 479
See also
>> (bitwise right shift)
>>> (bitwise unsigned right shift)
Availability
Flash Player 5.
Usage
expression1 >>> expression2
Parameters
expression1
expression2
Returns
A 32-bit unsigned integer.
Description
Operator (bitwise); the same as the bitwise right shift (
preserve the sign of the original
"Operator precedence and associativity" on page
A number or expression to be shifted right.
A number or expression that converts to an integer between 0 and 31.
expression
) operator except that it does not
>>
because the bits on the left are always filled with 0.
>>> (bitwise unsigned right shift)
32.
) operator.
>>=
127
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?