Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert XML string to uint hexadecimal color

Status
Not open for further replies.

maguskrool

Technical User
Dec 11, 2006
77
PT
Hello. I have an xml file containing color values to be applied in a series of shapes in my swf. However, when I try to assign the values, it doesn't work, it recognizes only a string and assigns the value 0 to the colors.

my_color.xml
Code:
<color_list>
  <color_1>0xFFBB00</color_1>
  ...
  <color_n>0xAA33FF</color_n>
</color_list>

The xml is then parsed into a variable called xmlColor.

.fla
Code:
var c1:uint = xmlColor.color_1;
trace (xmlColor.color_1) //0xFFBB00
trace (c1)               //0

 
I store my hex values in xml as just the hex, eg ff00ff and then say
var c1 = Number("0x" + xmlColour.colour_1);
or somesuch, and that turns out ok as the hex representation for working in flash and setting colours

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top