User Guide

ComboBox.selectedIndex 199
ComboBox.selectedIndex
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
comboBoxInstance.selectedIndex
Description
Property; the index number of the selected item in the drop-down list. The default value is 0.
Assigning this property clears the current selection, selects the indicated item, and displays the
label of that item in the combo boxs text box.
If you assign an out-of-range value to this property, Flash ignores it. Entering text into the text
field of an editable combo box sets
selectedIndex to undefined.
Example
With a ComboBox component instance my_cb, the following code selects the last item in the
list (otherwise, by default it would display the first item):
// Add Items to List.
my_cb.addItem({data:1, label:"First Item"});
my_cb.addItem({data:2, label:"Second Item"});
my_cb.addItem({data:3, label:"Third Item"});
my_cb.addItem({data:4, label:"Fourth Item"});
// Select last item on the list.
my_cb.selectedIndex = my_cb.length-1;
See also
ComboBox.selectedItem