User Guide
166 ComboBox component
Items in a combo box list are indexed by position, starting with the number 0. An item can be
one of the following:
■ A primitive data type.
■ An object that contains a label property and a data property
If the item is a primitive data type other than String, it is converted to a string. If an item is an
object, the
label property must be a string and the data property can be any ActionScript
value.
ComboBox methods to which you supply items have two parameters,
label and data, that
refer to the properties above. Methods that return an item return it as an object.
A combo box defers the instantiation of its drop-down list until a user interacts with it.
Therefore, a combo box may appear to respond slowly on first use.
Use the following code to programmatically access the ComboBox component’s drop-down
list and override the delay:
var foo = myComboBox.dropdown;
Accessing the pop-up list may cause a pause in the application. This may occur when the user
first interacts with the combo box, or when the above code runs.
Method summary for the ComboBox class
The following table lists methods of the ComboBox class.
NOTE
An object may use the ComboBox.labelFunction or ComboBox.labelField property to
determine the
label property.
Method Description
ComboBox.addItem() Adds an item to the end of the list.
ComboBox.addItemAt() Adds an item to the end of the list at the specified index.
ComboBox.close() Closes the drop-down list.
ComboBox.getItemAt() Returns the item at the specified index.
ComboBox.open() Opens the drop-down list.
ComboBox.removeAll() Removes all items in the list.
ComboBox.removeItemAt() Removes an item from the list at the specified location.
ComboBox.replaceItemAt() Replaces the content of the item at the specified index.
ComboBox.sortItems() Sorts the list using a compare function.
ComboBox.sortItemsBy() Sorts the list using a field of each item.