well i do not know how advanced you are but i am assuming you did not do this,
put a result handler then
private function popCombo(event:ResultEvent):void
{
var arrayCollection:ArrayCollection = event.result.whatever you need to get
todwn then
myComboBox.dataProvider = arrayCollection;
}
----- Original Message ----
From: xaero <[EMAIL PROTECTED]>
To: [email protected]
Sent: Sunday, June 8, 2008 10:55:03 PM
Subject: [flexcoders] How to populate a ComboBox?
I'm working with flex and amfphp (under Adobe 's php_ria_sdk that downloaded
from: http://www.adobe. com/devnet/ flex/articles/ flex_php_ sdk.html)
I'v got a problem with ComboBox.... I donn't how to populate the data that read
from the database.
The table of the database is like this:
------------ --------- --------
sid | atclass | ssname
------------ --------- --------
1 | 1 | Joe
2 | 1 | Jack
3 | 1 | Bob
4 | 3 | Sam
5 | 3 | Halen
------------ --------- --------
I use this function in my .php file to read the data:
function getStudents( $atClass) {
# Return a list of all the users
$sql = "SELECT * from students where atclass = '".$atClass. "'";
if ([EMAIL PROTECTED] this->mysqli->query($sql)) {
$errno=$this->mysqli->errno;
$this->mysqli->close();
trigger_error( "AMFPHP Remoting class database SELECT query error:
" . $errno);
}
while ($row = $result->fetch_assoc( )) {
$user_array[ ] = $row;
}
return($user_ array);
}
How can I populate the ComboBox with the data in $user_array ?
The `ssname` field -------- ComboBox's label.
And the `atclass` field ------------ -- ComboBox's data.