2 Replies Latest reply on Sep 29, 2010 1:40 PM by majester8425

    How do I traverse an XMLListCollection and get both Parent and child values ?

    majester8425 Level 1

      I used to populate my tree component via hard coded XML now it is through an xmllistcollection


      [Bindable] private var myXmlList:XMLListCollection = new XMLListCollection;


      The code below worked fine when I referenced the xml object and I could loop through all the elements, now however that is broken. How do I loop through an XMLListCollection and get the attribute values ?


      for each (var attribute:XML in myXmlList.@*)


            if (attribute.name(  ) == 'label')



                  (     attribute.parent(  ).@label   + "\n"      +

                        attribute.parent(  ).@id      + "\n"      +

                        attribute.name(  ) + "=" + attribute);