User Guide

176 ComboBox component
Example
With a ComboBox component instance my_cb on the Stage, the following example sends a
message to the Output panel when the drop-down list opens or closes:
// Add Items to List.
my_cb.addItem({data:1, label:"First Item"});
my_cb.addItem({data:2, label:"Second Item"});
// Create Listener Object.
var cbListener:Object = new Object();
cbListener.open = function(evt_obj:Object) {
trace("The ComboBox has opened.");
}
cbListener.close = function(evt_obj:Object){
trace("The ComboBox has closed.");
}
// Add Listener.
my_cb.addEventListener("open", cbListener);
my_cb.addEventListener("close", cbListener);
// Open the combo box.
my_cb.open();
See also
EventDispatcher.addEventListener()
ComboBox.dataProvider
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
comboBoxInstance.dataProvider
Description
Property; the data model for items viewed in a list. The value of this property can be an array
or any object that implements the DataProvider API. The default value is
[]. The List
component and the ComboBox component share the
dataProvider property, and changes
to this property are immediately available to both components.