ComboBox.selectedItem

Availability

Flash Player 6.0.79.

Edition

Flash MX 2004.

Usage

myComboBox.selectedItem

Description

Property; the value of the selected item in the drop-down list.

If the combo box is editable selectedItem returns undefined if you enter any text in the text box. It will only have a value if you select an item from the drop-down list, or the value is set via ActionScript. If the combo box is static, the value of selectedItem is always valid.

Example

The following example shows selectedItem if the data provider contains primitive types:

var item = myComboBox.selectedItem;
trace("You selected the item " + item);

The following example shows selectedItem if the data provider contains objects with label and data properties:

var obj = myComboBox.selectedItem;
trace("You have selected the color named: " + obj.label);
trace("The hex value of this color is: " + obj.data);

See also

ComboBox.dataProvider, ComboBox.selectedIndex