I want to be able to get my var from my XML file. But when I add another node in my XML file, let’s say its called <picNum>3</picNum> I can’t seem to get it into my flash file? Any clues on this? I only want one number under each <subnumber> node if thats possible?
I have this var in my .fla.
var picNum:Number = 3; // could be any number
and I load my XML like this:
var pArray = new Array();
var tArray = new Array();
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function (success:Boolean):Void {
if (success) {
var xmlData = this.firstChild.childNodes[0].childNodes[0];
for (var i = 0; i<xmlData.childNodes.length; i++) {
pArray.push(xmlData.childNodes*.childNodes[0].firstChild.nodeValue);
tArray.push(xmlData.childNodes*.childNodes[1].firstChild.nodeValue);
}
containerMC.loadPic(0);
picInfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
} else {
picInfo.text = "Unable to load external file.";
}
}
myXML.load("xml/XMLdata.xml")
And my XML file looks like this:
<?xml version="1.0" encoding="iso-8859-1" ?>
<xmlData>
<main>
<subnumber>
<subinfo>
<path>main1/images1/01.jpg</path>
<info><![CDATA[<p>main1, sub1</p>]]></info>
</subinfo>
<subinfo>
<path>main1/images1/02.jpg</path>
<info></info>
</subinfo>
<subinfo>
<path>main1/images1/03.jpg</path>
<info></info>
</subinfo>
</subnumber>
<subnumber>
<subinfo>
<path>main1/images2/01.jpg</path>
<info><![CDATA[<p>main1, sub2</p>]]></info>
</subinfo>
<subinfo>
<path>main1/images2/02.jpg</path>
<info></info>
</subinfo>
</subnumber>
</main>
</xmlData>