Flash Remoting TechNote

Combo box key selection not functioning with RecordSet

When populating a Macromedia Flash MX Combo Box component using setDataSource() or DataGlue.bindFormatStrings() the ability to select an item using the keyboard is disabled.


Both setDataSource() and DataGlue.bindFormatStrings() do not set the label and data properties of the combo box. The Combo Box component relies on the label to determine what item to scroll to when a user presses a key. Because the labels do not exist the selection function will not work when populated using these methods.


If the ability for a user to make a selection using the keyboard is required, it is possible to write a loop that would do the following:

  • Process the result object.
  • Reset the combo box.
  • Populate it with the result data.
  • Then sort the data alphabetically.

Because this script will populate the combo box by using the component's built-in functions, the label property will be used and the selection function will be able to process the data.

The following code example requires an advanced understanding of ActionScript and is the Result function for a service called myServiceName. In the example below there is a combo box instance named my_cb. This example also makes the assumption that the result objects items property contains a property called myReturnedProperty. In this situation, the server is returning a query from a database with a column named myReturnedProperty.

Note: If the structure of the result object that is being returned by the server is different than the following example, it is possible to see the format of the result object using a loop and a trace statement.

function myServiceName_Result(result) {

   // clear the combo box

   // grab the items from the result object
   myItems = result.items;

   // go through each item and populate the combo box
   for ( i in myItems ) {

      // get the current length of the combo box
      cbLength = my_cb.getLenght();

      // grab the value of the item and put it in the combo box
      myValue = myItems[i].myReturnedProperty;

    // put the value in the combo box
      my_cb.addItemAt(cbLength, myValue, myValue);


   // sort the list
   my_cb.sortItemsBy("Label", "ASC");


Last updated: June 24, 2002
Created: June 6, 2002
ID: 16406
Product: Flash Remoting
Versions: MX
OS: All
Browser: All
Server: None
Database: None
Former ID: N/A