Sunday, April 4, 2010

problem with an array collection

Hi!

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%26lt;IdAndName%26gt;. 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??????????????????????????

Thanks

problem with an array collection

How you make List%26lt;IdAndName%26gt;? 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%26lt;list.length ; i++?){

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

}

tell me if it don't help

No comments:

Post a Comment