3 Replies Latest reply on Sep 5, 2008 10:57 AM by cesaregb

    problem with arrayCollection

    cesaregb
      Hi all

      I have a little problem with an array collection

      the thing is that Im working with httpservices and this bring you and xml file and i have no problem when im using this xml

      <object>
      <item>
      <id>1</id>
      <name>MOSTRADOR</name>
      </item>
      <item>
      <id>2</id>
      <name>CAJERA</name>
      </item>
      <item><id>3</id>
      <name>FINANZAS</name>
      </item>
      </object>

      but for example when im using

      <object>
      <item>
      <id>1</id>
      <name>info </name>
      </item>
      </object>

      when i assign the information to the ArrayCollection variable i don't know why the result of this is null

      im assigning this file like this
      mySubmenus = e.result.object.item as ArrayCollection;

      and this is the code of the httpservice

      <mx:HTTPService id="myService"
      url=" http://mypage/bringInfo.php"
      showBusyCursor="true"
      result="showSuccess(event)"
      fault="showError(event)"
      />

      anyone can help me on this one, how should i assign this file this xml

      well i hope anyone can help me regards
        • 1. Re: problem with arrayCollection
          cesaregb Level 1
          anyone can help me on this one ??

          im kain of upset cause this i dont know why

          how should i do this ??
          • 2. Re: problem with arrayCollection
            Level 7

            "cesaregb" <webforumsuser@macromedia.com> wrote in message
            news:g9f1e9$c49$1@forums.macromedia.com...
            > Hi all
            >
            > I have a little problem with an array collection
            >
            > the thing is that Im working with httpservices and this bring you and xml
            > file
            > and i have no problem when im using this xml
            >
            > <object>
            > <item>
            > <id>1</id>
            > <name>MOSTRADOR</name>
            > </item>
            > <item>
            > <id>2</id>
            > <name>CAJERA</name>
            > </item>
            > <item><id>3</id>
            > <name>FINANZAS</name>
            > </item>
            > </object>
            >
            > but for example when im using
            >
            > <object>
            > <item>
            > <id>1</id>
            > <name>info </name>
            > </item>
            > </object>
            >
            > when i assign the information to the ArrayCollection variable i don't know
            > why
            > the result of this is null
            >
            > im assigning this file like this
            > mySubmenus = e.result.object.item as ArrayCollection;

            I think e.result will already contain the object level, if the format is
            e4X. If you're using the default Object format, I'm not so sure. I think
            when it comes back as Object and there's only one Object, for some reason it
            is null. You could try switching your result format to e4x and then use
            something like this:

            var myXMLList:XMLList=e.result.child('item');

            var myXMLListCollection:XMLListCollection=new XMLListCollection(myXMLList);

            mySubmenus - new ArrayCollection(myXMLListCollection.toArray());

            Though you might be better off just using the XMLListCollection.

            HTH;

            Amy


            • 3. Re: problem with arrayCollection
              cesaregb Level 1
              Thanks a lot this did work

              well i think i've to read a little more about this

              regards
              Cesar