Posted By

adrianparr on 02/09/11


Tagged

hex red colours color convert RGB as3 Blue Green


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

jazzy_miles
rydaly


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


 / Published in: ActionScript 3
 

  1. var brightPinkHex:uint = 0xFF32CC;
  2. var brightPinkRGB:Object = HexToRGB(brightPinkHex);
  3. trace(brightPinkRGB.r+ ", " + brightPinkRGB.g + ", " + brightPinkRGB.b);
  4.  
  5. function HexToRGB(value:uint):Object {
  6. var rgb:Object = new Object();
  7. rgb.r = (value >> 16) & 0xFF
  8. rgb.g = (value >> 8) & 0xFF
  9. rgb.b = value & 0xFF
  10. return rgb;
  11. }
  12.  
  13. // OUTPUT
  14. // 255, 50, 204

Report this snippet  

You need to login to post a comment.