Hello all!
I am working on a flash file that imports XML values into flash. I used tutorials from this forum and all worked nice. Now i would like to do one more thing but cant find solution or answer to it. Hope that you guys can help me out with it.
What i want to achieve is:
I am importing 8 numbers from XML file first 4 called HOT number next 4 called COLD number and i show it in dynamic text boxes in flash file. XML changes and values in the file changes as well.
I want to check if imported number is : 1 or 2 or 3 or 7 or 8 or 9 then color of imported number should be red , if number is for example 4,5,10,12,15 then color is black other numbers color green. Numbers are from 0-36
How can I do that? I pasted code i have right now below.
Thanks for any help.
XML
<?xml version="1.0" encoding="utf-8"?>
<NUMBERS>
<hotnumbers>
<hotnumber1>32</hotnumber1>
<hotnumber2>22</hotnumber2>
<hotnumber3>3</hotnumber3>
<hotnumber4>12</hotnumber4>
</hotnumbers>
<coldnumbers>
<coldnumber1>66</coldnumber1>
<coldnumber2>67</coldnumber2>
<coldnumber3>68</coldnumber3>
<coldnumber4>69</coldnumber4>
</coldnumbers>
</NUMBERS>
AS 2.0
function loadXMLData(loaded)
{
if (loaded) {
_root.hotnumber1 = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.hotnumber2 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.hotnumber3 = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
_root.hotnumber4 = this.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;
_root.coldnumber1 = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
_root.coldnumber2 = this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
_root.coldnumber3 = this.firstChild.childNodes[1].childNodes[2].firstChild.nodeValue;
_root.coldnumber4 = this.firstChild.childNodes[1].childNodes[3].firstChild.nodeValue;
hotnum1_txt.text = _root.hotnumber1;
hotnum2_txt.text = _root.hotnumber2;
hotnum3_txt.text = _root.hotnumber3;
hotnum4_txt.text = _root.hotnumber4;
colnum1_txt.text = _root.coldnumber1;
colnum2_txt.text = _root.coldnumber2;
colnum3_txt.text = _root.coldnumber3;
colnum4_txt.text = _root.coldnumber4;
}
else {
trace("Could not load XML file");
}
}
xmlFile = new XML();
xmlFile.ignoreWhite = true;
xmlFile.onLoad = loadXMLData;
xmlFile.load("hotcold.xml");
Regards
Goomy