EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Bitwise Left Shift and Assignment Operator; Bitwise NOT Operator

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
128 ActionScript language elements
<<= bitwise left shift and assignment operator
expression1 <<= expression2
This operator performs a bitwise left shift (<<=) operation and stores the contents as a result
in
expression1. The following two expressions are equivalent:
A <<= BA = (A << B)
Availability: ActionScript 1.0; Flash Lite 2.0
Operands
expression1 : Number - A number or expression to be shifted left.
expression2 : Number - A number or expression that converts to an integer from 0 to 31.
Returns
Number - The result of the bitwise operation.
Example
In the following example, you use the bitwise left shift and assignment (<<=) operator to shift
all bits one space to the left:
var x:Number = 4;
// shift all bits one slot to the left.
x <<= 1;
trace(x); // output: 8
// 4 decimal = 0100 binary
// 8 decimal = 1000 binary
See also
<< bitwise left shift operator, >>= bitwise right shift and assignment
operator
, >> bitwise right shift operator
~ bitwise NOT operator
~expression
Also known as the one's complement operator or the bitwise complement operator. Converts
the
expressionto a 32-bit signed integer, and then applies a bitwise one's complement. That
is, every bit that is a 0 is set to 1 in the result, and every bit that is a 1 is set to 0 in the result.
The result is a signed 32-bit integer.
For example, the hex value 0x7777 is represented as this binary number: 0111011101110111
The bitwise negation of that hex value, ~0x7777, is this binary number: 1000100010001000

Table of Contents

Related product manuals