Return to Snippet

Revision: 24524
at March 3, 2010 04:34 by adrianparr


Initial Code
var colour:uint = 0x9900CC;
var r:uint = colour >> 16;
var g:uint = colour >> 8 & 0xFF;
var b:uint = colour & 0xFF;

trace("r: "+r);
trace("g: "+g);
trace("b: "+b);

// OUTPUT
// r: 153
// g: 0
// b: 204

Initial URL
http://theflashblog.com/presentations/bytearrays.html

Initial Description

                                

Initial Title
AS3 Convert a Hex Value to RGB Using Bitwise Operators

Initial Tags
convert

Initial Language
ActionScript 3