I have an XML file that is passing the color that is needed on a movie clip.
I can make the color variable in the XML the actual HEX number and that works fine.
Example:
//XML
<ColorData>
<!--1001-->
<ClipColor mcColor="0x990000" /ClipColor>
</ColorData>
//Actionscript
my_xml = new XML();
my_xml.load("ColorMC.xml");
my_xml.onLoad = my_function;
my_xml.ignoreWhite = 1;
function my_function() {
var mc1001color = my_xml.firstChild.childNodes[0].attributes.mcColor;
var newcolor1001:Color = new Color(mc_1001);
newcolor1001.setRGB(mc1001color);
}
But I would like to change the hex number in the xml into a a color name like red,
blue, green or gray to make it less confusing to the person generating the xml.
But I am having trouble tring to figure out how to change the color name back to the hex numbers
in the actionscrit.
I tried declaing the color names as variables with the hex numbers, but I am kind of stuck,
Everything I tried so far has not worked.
//XML
<ColorData>
<!--1001-->
<ClipColor mcColor="Red" /ClipColor>
</ColorData>
//Actionscript
my_xml = new XML();
my_xml.load("ColorMC.xml");
my_xml.onLoad = my_function;
my_xml.ignoreWhite = 1;
function my_function() {
var mc1001color = my_xml.firstChild.childNodes[0].attributes.mcColor;
var Red = 0x990000;
var Blue = 0x013E98;
var Green = 0x09913F;
var Gray = 0xBFBFBF;
var newcolor1001:Color = new Color(mc_1001);
newcolor1001.setRGB(mc1001color);
}
There are actully going to be over 600 movie clips to color so I would like to keep the code simple
and swap the hex number for the color names just once if posable.
Thanks for any help.