Hi All,
I try to get the node length from my XML file, I followed the Senocular tut on XML and AS3, very helpfull, but still I 'm stuck and any search on google or forum is a confusing mix from AS2, so please some help.
When I trace xmlData, it works fine. I found several notations for node length, I came up with this…:hangover:
code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
var nodes:Number;
var aantal:Number;
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlData.ignoreWhite=true;
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("sampleXML.xml"));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
nodes = xmlData.firstChild.length;
aantal = nodes.length;
trace (aantal);
}
XML file:
<snippers>
<snipper image="snipper1.png" snippertekst="Zwemmen" />
<snipper image="snipper2.png" snippertekst="Fietsen" />
<snipper image="snipper3.png" snippertekst="Lopen" />
<snipper image="snipper4.png" snippertekst="Training" />
<snipper image="snipper5.png" snippertekst="Wissel"/>
<snipper image="snipper6.png" snippertekst="Materiaal" />
<snipper image="snipper7.png" snippertekst="Techniek" />
<snipper image="snipper8.png" snippertekst="Begeleiding" />
<snipper image="snipper9.png" snippertekst="Trainer" />
<snipper image="snipper10.png" snippertekst="Voeding" />
</snippers>