Example
The following example retrieves the selected indices:
var selIndices:Array = my_list.selectedIndices;
The following example selects four items:
var my_array = new Array (1, 4, 5, 7);
my_list.selectedIndices = my_array;
The following example selects two list items by default and displays their label property in the
Output panel:
my_list.multipleSelection = true;
my_list.addItem({data:"flash", label:"Flash"});
my_list.addItem({data:"dreamweaver", label:"Dreamweaver"});
my_list.addItem({data:"coldfusion", label:"ColdFusion"});
my_list.selectedIndices = [0, 2];
var numSelected:Number = my_list.selectedIndices.length;
for (var i:Number = 0; i < numSelected; i++) {
trace("selectedIndices[" + i + "] = "+
my_list.getItemAt(my_list.selectedIndices[i]).label);
}
See also
List.selectedIndex
List.selectedItem
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
listInstance.selectedItem
Description
Property (read-only); an item object in a single-selection list. (In a multiple-selection list with
multiple items selected,
there is no selection, the value is
,
List.selectedItem
returns the item that was most recently selected.) If
selectedItem
undefined
,
List.selectedItems
.
List.selectedItem
803
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?