Dear All,
Been trying this for a while, and there is no problem finding a good tutorial in as2, but to find something in as3 is hard and as I’m trying to learn as3 it would be great if one of you could give a hint…(solution :tini:)…
I’ve got so far (with already some help from senocular;)), the code places 10 movieclips on stage and gives them name ranging from snipper1 to snipper10, now I want to display in each movieclip the correct image and tekst, which is given by the XML file, so for movieclip snipper 1, image snipper1.png and tekst Theme1 should be displayed… AArrggh am I STUCK PLEASE HELP… Thanks
p.s. Does it make sense to import the XMLNode and XMLNodeType class for this purpose??
I have this code:
import flash.xml.XMLNode;
import flash.xml.XMLNodeType;
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);
aantal = xmlData.elements().length();
for(var i:Number = 0; i<aantal;i++){
var container:MovieClip = new Container();
container.name = "snipper"+ i;
addChild(container)
}
XML file:
<snippers>
<snipper image="snipper1.png" snippertekst="Theme1" />
<snipper image="snipper2.png" snippertekst="Theme2" />
<snipper image="snipper3.png" snippertekst="Theme3" />
<snipper image="snipper4.png" snippertekst="Theme4" />
<snipper image="snipper5.png" snippertekst="Theme5"/>
<snipper image="snipper6.png" snippertekst="Theme6" />
<snipper image="snipper7.png" snippertekst="Theme7" />
<snipper image="snipper8.png" snippertekst="Theme8" />
<snipper image="snipper9.png" snippertekst="Theme9" />
<snipper image="snipper10.png" snippertekst="Theme10" />
</snippers>