Hey there,
this is my first attempt at parsing xml into flash from scratch, i’ve read through most of senocular’s tut on kirupa so i’ve got a loose grasp of the fundamentals, i just need help filling in the gray areas.
this is the xml i’m attempting to parse;
<stageitems>
<stage>
<homehead>Blah Blah</homehead>
<homebody>Blah Blah</homebody>
<homefooter>Blah Blah</homefooter>
</stage>
// **the 'stage' node below here repeats three more times**
<stage title="RENEWAL" path="images/renewal" >
<item image="LHimage_1.png">
<description> The first left hand image of Renewal</description>
</item>
<item image="LHimage_2.png">
<description> The Second left hand image of Renewal</description>
</item>
<item image="RHimage_1.png">
<description> The first right hand image of Renewal</description>
</item>
<item image="RHimage_2.png">
<description> The Second right hand image of Renewal</description>
</item>
</stage>
<stageitems>
And heres what i’ve played with just to retrieve the first ‘stage’ nodeValues, but i just can’t get it to click ;
[AS]
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function(success) {
if (success) {
var stage = this.firstChild.childNodes;
numOfStages = stage.length;
for (var i = 0; i<numOfStages; i++) {
var homehead = stage*.firstChild;
var homebody = stage*.childNodes[1];
var homefooter = stage*.childNodes[2];
castMC.StagesWrap.homeMC.homeHeader_txt.text = homehead.firstChild.nodeValue;
castMC.StagesWrap.homeMC.homeBody_txt.text = homebody.firstChild.nodeValue;
castMC.StagesWrap.homeMC.homeFooter_txt.text = homefooter.firstChild.nodeValue;
}
} else {
castMC.StagesWrap.homeMC.homeFooter_txt.text = “Error loading XML file”;
}
};
// load the xml
xml.load(“headerData.xml”);
[/AS]
it just returns, null :jail: and i just can’t figure out why
thanks
Cam