User Guide

478 Chapter 6: Components Dictionary
Description
Property; the selected index of a single-selection list. The value is undefined if nothing is
selected; the value is equal to the last item selected if there are multiple selections. If you assign a
value to
selectedIndex, any current selection is cleared and the indicated item is selected.
Using the
selectedIndex property to change selection doesnt dispatch a change event. To
dispatch the
change event, use the following code:
myList.dispatchEvent({type:"change", target:myList});
Example
This example selects the item after the currently selected item. If nothing is selected, item 0 is
selected.
var selIndex = myList.selectedIndex;
myList.selectedIndex = (selIndex==undefined ? 0 : selIndex+1);
See also
List.selectedIndices
, List.selectedItem, List.selectedItems
List.selectedIndices
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX 2004.
Usage
listInstance.selectedIndices
Description
Property; an array of indices of the selected items. Assigning this property replaces the current
selection. Setting
selectedIndices to a zero-length array (or undefined) clears the current
selection. The value is
undefined if nothing is selected.
The
selectedIndices property reflects the order in which the items were selected. If you click
the second item, then the third item, and then the first item,
selectedIndices returns [1,2,0].
Example
The following example retrieves the selected indices:
var selIndices = myList.selectedIndices;
The following example selects four items:
var myArray = new Array (1,4,5,7);
myList.selectedIndices = myArray;
See also
List.selectedIndex
, List.selectedItem, List.selectedItems