Hi, I´m trying to parse an XML file and I have a problem to read the childs of a node.
My XML file have this structure:
And here is my AS code:Code:<?xml version="1.0" encoding="utf-8"?> <code> <images jpgURL="small/m1.jpg" url="big/bg1.jpg" name="Lorem Ipsum"> <buttons> <button posX="550" posY="438" textX="Lorem Ipsum1"/> <button posX="620" posY="438" textX="Lorem Ipsum2"/> <button posX="650" posY="116" textX="Lorem Ipsum3"/> <button posX="120" posY="248" textX="Lorem Ipsum4"/> </buttons> </images > <images jpgURL="small/m2.jpg" url="big/bg2.jpg" name="Lorem Ipsum"> <buttons> <button posX="240" posY="268" textX="Lorem Ipsum1"/> <button posX="435" posY="388" textX="Lorem Ipsum2"/> </buttons> </images > </code>
The Output panel shows this traces:Code:function initXml(miXML){ var totals = miXML.firstChild.childNodes; for(var i=0; i < totals.length; i++){ var thumbs = totals[i]; var buttons = thumbs.firstChild.childNodes; var thumb = thumbLoader.attachMovie("item1_mc", "item1" + i, i + 1000, {id: i, num: i}); for (var j=0; j < buttons .length; j++){ var button = buttons [j]; trace("posX= "+ boton.attributes.posX +" posY= "+ boton.attributes.posY +" text= " + boton.attributes.texto); } } }
And I want that only trace all the childNodes of the first button node, like this:posX= 550 posY= 438 text= Lorem Ipsum1
posX= 240 posY= 438 text= Lorem Ipsum1
How can I trace this?posX= 550 posY= 438 text= Lorem Ipsum1
posX= 240 posY= 438 text= Lorem Ipsum2
posX= 650 posY= 116 text= Lorem Ipsum3
posX= 120 posY= 248 text= Lorem Ipsum4
Thank you!




Reply With Quote