(Bitwise Right Shift And Assignment) - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

>>= (bitwise right shift and assignment)
Availability
Flash Player 5.
Usage
expression1 >>= expression2
Parameters
expression1
expression2
Returns
A 32-bit integer.
Description
Operator (bitwise compound assignment); this operator performs a bitwise right-shift operation
and stores the contents as a result in
The following two expressions are equivalent:
A >>= B
A = (A >> B)
For more information, see "Operator precedence and associativity" in Using ActionScript in Flash.
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)
A number or expression to be shifted right.
A number or expression that converts to an integer from 0 to 31.
expression1
.
>>= (bitwise right shift and assignment)
) operator.
>>=
89

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents