3 Replies Latest reply on Oct 20, 2013 5:09 AM by Ned Murphy

    Problem with pushing xml child attribute to an empty array


      Hi guys,


      I have another problem with putting, or shall I say, pushing data from xml to an empty array I previously declared.


      During the xml_mc.onload, I can see the data, but after that, it becomes undefined.


      It seems like I could not find the solution on the net as well. I suspect it is not possible, but I wont give up.


      Please help me.




      This is the code sample:



      var myarray=new Array();


      var xml1:XML = new XML();



      xml1.onLoad = function(success:Boolean){





            var nodes = this.firstChild.childNodes;


                          for (i=0; i<nodes.length; i++){




               text1.text=myarray[2];  // *******************************to check if the attribute "name" is visible


                } else {

                          trace("Could not load XML");








      text1.text=myarray[2]; // *******************************I commented the first  text to try to view again, and result was UNDEFINED..........






      the xml would look like this:







           <icon name="icon1" />

           <icon name="icon2" />

           <icon name="icon3" />

           <icon name="icon4" />