Return to Snippet

Revision: 40911
at February 9, 2011 22:02 by adrianparr


Initial Code
var brightPinkHex:uint = 0xFF32CC;
var brightPinkRGB:Object = HexToRGB(brightPinkHex);
trace(brightPinkRGB.r+ ", " + brightPinkRGB.g + ", " + brightPinkRGB.b);

function HexToRGB(value:uint):Object {	
	var rgb:Object = new Object();
	rgb.r = (value >> 16) & 0xFF
	rgb.g = (value >> 8) & 0xFF
	rgb.b = value & 0xFF			
	return rgb;
}

// OUTPUT
// 255, 50, 204

Initial URL

                                

Initial Description

                                

Initial Title
AS3 Hex Colour (uint) to RGB Colours (Object)

Initial Tags
color, convert

Initial Language
ActionScript 3