2 Replies Latest reply on Oct 17, 2009 7:00 AM by Gregory Lafrance

    access values of ArrayCollection

    Alex-SM Level 1

      Hi,

       

      My simple Flex program uses HTTPService to store data from php/mysql into an ArrayCollection in xml format as follow:

       

      xml format

      <root>
        <customers>
           <customer>
              <name>John</name>
           </customer>
           <customer>
              <name>Sam</name>
           </customer>
           ...
           ...
        </customers>
        <count>2</count>
      </root>

       


      HTTPService
      <mx:HTTPService id="post_service"
          url="test.php"
             method="POST"
            result="result_handler(event)">
            <mx:request xmlns="">
            ...
           </mx:request>
      </mx:HTTPService>

       


      Store to ArrayCollection
      private function result_handler_iad(e:ResultEvent):void
      {
          myData = new ArrayCollection([e.result.root.customers.customer]);
          ...
      }

       

      How can I read a value of a specific xml field in specific index using myData ArrayCollection ? i.e how can I read the value of count or name using myData?

       

      Thanks,

      ASM