Hi folks
Am having big problems trying to figure this out.
I will show you my problem…
I have successfully loaded this xml file ->
[color=green]
<?xml version=“1.0” encoding=“UTF-8”?>
<content>
<question number=“1”>
<quarter>
<one>10</one>
<two>20</two>
<three>30</three>
</quarter>
<quarter>
<one>72</one>
<two>60</two>
<three>52</three>
</quarter>
</question>
</content>[/color]
this is my AS
[color=darkred]function myOnLoad(success) {
if (success) {
mainTag = myXML.firstChild;
if (myXML.firstChild.nodeName.toLowerCase() == "content") {
questionList = mainTag.childNodes;
for (var i = 0; i<questionList.length; i++) {
if (questionList*.firstChild.nodeName.toLowerCase() == "quarter") {
quarterList = questionList*.childNodes;
trace("quarterList.length = "+quarterList.length);
for (var x = 0; x<quarterList.length; x++) {
barChartData = quarterList[x].childNodes;
for (var k = 0; k<barChartData.length; k++) {
quarterList[x].dataToDisplay=new Array();
quarterList[x].dataToDisplay = barChartData[k].firstChild.nodeValue;
}
}
}
}
}
} else {
trace("Error loading XML document");
}
gotoAndPlay("main");
}
[/color]
Now, i want to take those values in “quarterList[x].dataToDisplay” and assign them like this:
[color=darkred]for (var i = 0; i<quarterList.length; i++) {
for (var x = 0; x<barChartData.length; x++) {
this["col"+x] = quarterList*.dataToDisplay[k];
trace(this["col"+x]);
}
}[/color]
But this doesn’t work. When i use trace, all i get on the screen is “undefined” for each iteration.
Can anyone help?