Browsing Category: "Flash"

Use BitWise Operators in Flash to Turn the Output of getPixel() to a String

ActionScript, Flash March 20th, 2008

I’ve been working on a pixel color capture Flash Movie and I needed some help understanding how to work with the value that the getPixel() function returned.    I found a great explanation over at Flash-Creations under the Operators section.

ActionScript Operators

nRed = nColor >> 16; Given an RGB color nColor, pull the red part into variable nRed. How? Colors are specified by 3 groups of 2 hex digits each:RRGGBB. Each hex digit is 4 bits, so each color is specified by 8 bits: rrrrrrrrggggggggbbbbbbbb. The “>>” operator shifts bits to the right by the amount specified. So to get the red part (leftmost group of 8 bits), you simply shift all the bits to the right 16 slots (the lower part, the G and B colors, are discarded during the shift).

Read Full Page Here

Also, to clarify the process, here is some sample code from this tutorial at:

 g.wygonik’s flash experiments

———————————————————————————

 tr = (tmpC >> 16);
 tg = (tmpC >> 8 ^ tr << 8);
 tb = (tmpC ^ (tr << 16 | tg << 8));

———————————————————————————

You’ll notice that this examples uses another operator (^), the bitswise XOR operator to get the difference of two binary elements.  Great example in livedocs:

Flash Documentation

Example

The following example uses the bitwise XOR operator on the decimals 15 and 9, and assigns the result to the variable x:
// 15 decimal = 1111 binary

// 9 decimal = 1001 binary

var x:Number = 15 ^ 9;

trace(x);

// 1111 ^ 1001 = 0110

// returns 6 decimal (0110 binary)  

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Motorola’s Making Of the Razr Movie Site

Papervision3D, Flash October 22nd, 2007

A nice example of Papervision3D at work in Flash as a navigation system.

http://direct.motorola.com/hellomoto/razr2/razr2makingof/

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Flickr TiltViewer

Away3D, Papervision3D, Flash September 28th, 2007

Using Flash and Away3D, check out this gallery:

http://www.airtightinteractive.com/projects/tiltviewer/app/

Flickr TiltViewer

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Flash Charts - amCharts

Flash September 20th, 2007

Another Flash Charts suite

http://www.amcharts.com/column/examples/8/

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
blank