ActionScript 2.0 Components Language Reference |
|
|
|
| List component > List.getItemAt() | |||
Flash Player 6 (6.0.79.0).
Flash MX 2004.
listInstance.getItemAt(index)
index A number greater than or equal to 0, and less than List.length. It specifies the index of the item to retrieve.
The indexed item object; undefined if the index is out of range.
Method; retrieves the item at the specified index. This method gets the data item either from an array, DataProvider, or from a data object created with CellRenderer.setValue().
The following code displays the label of the item at index position 2. To try this code, drag a List component to the Stage and give it the instance name my_list. Add the following code to Frame 1 in the timeline:
var my_list:mx.controls.List;
my_list.addItem({data:'flash', label:'Flash'});
my_list.addItem({data:'dreamweaver', label:'Dreanweaver'});
my_list.addItem({data:'coldfusion', label:'ColdFusion'});
trace(my_list.getItemAt(2).label);
|
|
|
|