Actionscript flex: Converting # colors to uint

actionscript-3apache-flex

I'm working with several components that take color as a uint, but the colors I have are in the format of "#161616". I'm not sure what the relation between the 2 types of colors are or how to go from one to another.

It doesn't have to be an actionscript solution. I have only a small number of these colors, so can be done manually too.

Best Answer

var color:uint = 0x161616;

Or, to convert them programmatically:

var s:String = "#161616";
var color:uint = uint("0x" + s.substr(1));
Related Topic