1 Reply Latest reply on Sep 2, 2009 6:30 AM by sergei_developer

    problem with an array collection

    quebequiano Level 1



      I working with Flex/Java RemoteObject.


      I have the following object in Java



      public class IdAndName {


          private String userId;
          private String userName;





      and the equivalent in Flex


          public class IdAndName {
              private var _userId:String;
              private var _userName:String;



      I call a method in Java that returns a List<IdAndName>. I get the list in flex the following way:


                      var list:ArrayCollection=ArrayCollection(event.result);


      So the var list has the list of IdAndName.



      My Question is...:


      How can i obtain an ArrayCollection in Flex with the userIds (only them and not the userName??????????????????????????




        • 1. Re: problem with an array collection

          How you make List<IdAndName>? you can fix your list in java or rewrite your ArrayCollection in flex like this:

          var list:ArrayCollection=ArrayCollection(event.result);

          var  reList:ArrayCollection=new  ArrayCollection();

          for(var i:int = 0 ; i<list.length ; i++  ){

               reList.addItem((list.getItemAt(i) as array)[0]);     // if userIds is first



          tell me if it don't help