2 Replies Latest reply on Jan 14, 2010 9:24 AM by Gregory Lafrance

    Using Repeater with XMLList

    andreamesser Level 1

      Hi,

       

      I have an XMLList with two items <answer>yes</answer> and <answer>no</answer>. I am trying to convert these into an Array Collection so I can use them with the Repeater and have a radio button display for each choice. I tried using Repeater with my XMLList and cant get that to work and I cannot get my XMLList to become an Array Collection.

       

      Any help with either of the two issues would very much appreciated.

        • 1. Re: Using Repeater with XMLList
          RK...

          Conversion of XMLList to ArrayCollection

           

          private var xmlDP: XML = <answers>
                         <answer>Yes</answer>
                         <answer>No</answer>
                    </answers>;
          
          private var acDP: ArrayCollection = new ArrayCollection();
          
          private function conversion(): void {
               var tmp: XMLList = xmlDP.answer;
               for (var i: int = 0; i < tmp.length(); i++) {
                    acDP.addItem(tmp[i]);
               }
          }
          
           
          

          • 2. Re: Using Repeater with XMLList
            Gregory Lafrance Level 6

            Use and XMLListCollection, then use the toArray() method.

             

            var ac:ArrayCollection = new ArrayCollection(myXLC.toArray());

             

            If this post answers your question or helps, please mark it as such.


            Greg Lafrance - Flex 2 and 3 ACE certified

            www.ChikaraDev.com

            Flex / AIR Development, Training, and Support Services