PDA

View Full Version : How to convert the Color code from number to Hexadecimal?


nirasiva
10-21-2011, 10:41 AM
Hai
I passed dynamically value for color code But Its number format,but i need Hexadecimal color code?how can i convert numer format to Hexadecimal format in as3?
here my code
var tf:TextField = new TextField();
tf.text ="jkg"
tf.textColor = chatData.user;///Here Dynamically i passed Its like Number format(16777215),i need hexa Decimal format.
listChat.addChild(tf);

infernosnow
10-21-2011, 11:52 AM
chatData.user.toString(16)

try this?

nirasiva
10-21-2011, 12:11 PM
am trying Sir But it Displays FFFFFF like that only But the Format is 0x ,,if i added "0x" as String means Nothing Displayed

5TonsOfFlax
10-21-2011, 05:17 PM
The textColor property of TextField is a uint, not a String. You do not need to format your number in any particular way, since it is the value that matters, not the presentation.

tf.textColor = uint(chatData.user);

Now, if chatData.user is a String, then you will have to convert that String to a uint value.

nirasiva
10-22-2011, 05:03 AM
ya Thank you 5TonsOfFlax ! i got it