I'm trying to do one of the easiest thing to do in Actionscript, but the code just seems to want to work with the 3rd node of the XML. Here is the XML code:
<?xml version="1.0" encoding="utf-8"?>
<flags>
<flag>
<sigla>pt-br</sigla>
<png>brazil.png</png>
<nome>Portugues</nome>
</flag>
<flag>
<sigla>esp</sigla>
<png>spain.png</png>
<nome>Espanol</nome>
</flag>
<flag>
<sigla>en</sigla>
<png>usa.png</png>
<nome>English</nome>
</flag>
</flags>
And Here is the AS2 code:
var flagsXML = new XML();
flagsXML.ignoreWhite = true;
_root.linkFlags = "";
_root.flagSpacing = 5;
flagsXML.onLoad = function(success:Boolean){
if(success){
flagsNode = flagsXML.firstChild;
flagsTotal = flagsNode.childNodes.length;
for(i=0;i<flagsTotal;i++){
//var flagItem = new MovieClip();
flagItem = flagsMc.attachMovie("idioma","idioma"+i,_root.getNextHighestDepth());
flagItem.png.loadMovie("img_idiomas/"+String(flagsNode.childNodes[i].childNodes[1].childNodes[0].nodeValue));
//loadMovie("img_idiomas/"+flagsNode.childNodes[i].childNodes[1].childNodes[0].nodeValue);
flagItem._x -= 16*(i+1);
trace("sigla"+i+": "+flagsNode.childNodes[i].childNodes[1].childNodes[0].nodeValue);
}
}
}
flagsXML.load("xml/flags.xml");
ok. In the Trace commands, he output the name of the png well, but it only actually attaches the movieClip in the LAST 'for' iteration. I tried to debug the movie, and it doesn't even attaches the movie when i=0 or 1.
Ah, I double checked the images folder, the file names, and etc.
Thanks for any help.