1 Reply Latest reply on May 7, 2008 9:06 PM by atta707

    Populating an ArrayCollection from HttpService

      I am using the following variable:

      public var userDisp:ArrayCollection;

      That is being populated by:
      <mx:HTTPService id="classUserlist" url="{' http://' + servername + ':' + serverport + '/basicskills/classUserListXml.do;jsessionid=' +sessionId }" result="studentDataHdlr(event)" />

      private function studentDataHdlr(event:ResultEvent):void{

      if (event.result.userlist != null) {
      userDisp= event.result.userlist.user as ArrayCollection;
      Alert.show("LENGTH:" + userDisp.length, "", Alert.OK , this, null, null, Alert.OK);

      When the XML has more than one <user> As in the following example:
      The ArrayCollection is populated properly:

      <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
      - <userlist>
      - <user>
      <fullname>Reznor, Trent</fullname>
      - <user>
      <fullname>test2, test2</fullname>

      When there is only one user <user> the ArrayCollection does not populate:
      <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
      - <userlist>
      - <user>
      <fullname>Slaughter, Mark</fullname>

      This happens with all of my arrayCollections, Am I missing something? I cannot figure out what is going on.

      Thank you in advance.