/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var brightPinkCSS:String = "#FF32CC"; var brightPinkRGB:Object = HexToRGB(brightPinkCSS); trace(brightPinkRGB.r+ ", " + brightPinkRGB.g + ", " + brightPinkRGB.b); function HexToRGB(value:String):Object { if (value.indexOf("#") != -1) { value = "0x"+ value.split("#").join(""); } else { value = "0x"+ value; } var hexValue:uint = parseInt(value, 16); var rgb:Object = new Object(); rgb.r = (hexValue >> 16) & 0xFF rgb.g = (hexValue >> 8) & 0xFF rgb.b = hexValue & 0xFF return rgb; } // OUTPUT // 255, 50, 204