Useful HexColor Extract Code

This code help me solve many cool effect and also shorten my writing. Also sometime it is easily to forget so here is another good tips to note on here 🙂

var colour:uint = 0xFF297400;
var A:Number = colour >> 24 & 0xFF;
var R:Number = colour >> 16 & 0xFF;
var G:Number = colour >> 8 & 0xFF;
var B:Number = colour & 0xFF;

// RGB
var colourRBG:uint = (R << 16 | G << 8 | B);

// ARGB
var colourARBG:uint = (A << 24 | R << 16 | G << 8 | B);