Example
The following example displays the selected label:
trace(my_list.selectedItem.label);
The following example displays the contents of a selected whenever the user selects a new item
from the list:
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"});
//Create listener object.
var listListener:Object = new Object();
listListener.change = function(evt_obj:Object) {
// Display each property of the object.
var tempStr:String = "[object";
for (var i:String in evt_obj.target.selectedItem) {
tempStr += " " + i + ":'" + evt_obj.target.selectedItem[i]+"'";
}
tempStr += "]";
trace(tempStr);
};
// Add listener.
my_list.addEventListener("change", listListener);
See also
List.selectedIndex
List.selectedItems
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
listInstance.selectedItems
Description
Property (read-only); an array of the selected item objects. In a multiple-selection list,
lets you access the set of items selected as item objects.
selectedItems
804
List component
,
List.selectedIndices
,
List.selectedItems
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers