lickuid
04-11-2007, 06:27 PM
I have a unique interesting problem with setting the color value of a textFormat object at runtime. What goes on is this:
1): I have a custom color gradient color picker object that, when you mousedown and mouseover it, the rgb values change according to the pixel the mouse is over.
2): After I get the rgb values, I then convert it to a hex value in this format: 0xRRGGBB
3): that value is first assigned to a string variable, then the string variable is assigned to a number variable. this works flawlessly so far.
but here's the problem...
4):I have already created a textFormat Object, but want to assign the hex value of the number variable to the textFormat Object. example:
var hexString:String = '0x' + //formula for calculating hex
var hexNum:Number = hexString
my_fmt.color = hexNum
the last line above always returns '0' when I trace() it when I'm expecting to see that hex variable. I also tried hardcoding the hexNum variable with a hex value and this worked, but I need it to pull from that changing variable at runtime, does anyone know how to pull this off?
Much thanks to all help.
Note. I tried using the setTransform() method also to no avail. I'd rather use hex instead of the transform method, but I'll take what I can get.
1): I have a custom color gradient color picker object that, when you mousedown and mouseover it, the rgb values change according to the pixel the mouse is over.
2): After I get the rgb values, I then convert it to a hex value in this format: 0xRRGGBB
3): that value is first assigned to a string variable, then the string variable is assigned to a number variable. this works flawlessly so far.
but here's the problem...
4):I have already created a textFormat Object, but want to assign the hex value of the number variable to the textFormat Object. example:
var hexString:String = '0x' + //formula for calculating hex
var hexNum:Number = hexString
my_fmt.color = hexNum
the last line above always returns '0' when I trace() it when I'm expecting to see that hex variable. I also tried hardcoding the hexNum variable with a hex value and this worked, but I need it to pull from that changing variable at runtime, does anyone know how to pull this off?
Much thanks to all help.
Note. I tried using the setTransform() method also to no avail. I'd rather use hex instead of the transform method, but I'll take what I can get.