And best practice is to wrap the array in an ArrayCollection:
public _acStudents:ArrayCollection;
var aStudents:Array = result; //This will have a problem if there is a
single element in the array. Look into toArray()
...
_acStudents = new ArrayCollection(aStudents);
...
dataProvider="{_acStudents }
Tracy
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of DANIEL CREDIDIO - INFORMATICA
Sent: Monday, June 09, 2008 11:19 AM
To: [email protected]
Subject: RES: [flexcoders] Can Array or ArrayCollection be populated
into ComboBox?
Put this in the combobox --> labelField ="ssname"
De: [email protected] [mailto:[EMAIL PROTECTED] Em
nome de xaero
Enviada em: segunda-feira, 9 de junho de 2008 12:16
Para: [email protected]
Assunto: [flexcoders] Can Array or ArrayCollection be populated into
ComboBox?
Hi, everyone!
In my PHP file, there is a function that returns an Array $user_array
the data in this Array is something like this:
[0]
atclass = "1"
sid = "3"
ssname = "Joe"
[1]
atclass = "1"
sid = "4"
ssname = "Sam"
[2]
atclass = "1"
sid = "5"
ssname = "Simth"
And I want to add the `sid` and `ssname` into the ComboBox.
So in the flex, I use 'result' in the function to receive the data:
public ssProvider:Array;
...
gateway.call("cys.getStudents", new Responder(onResult,
onFault),atClass); //It gets the data from database
...
public function onResult(result:Array):void
{
ssProvider = result;
}
...
<mx:ComboBox dataProvider="{ssProvider}"/>
And it just display [object][object], nothing else....
How to fix it?