F > FListBox.getItemAt

 

FListBox.getItemAt

Availability

Flash Player 6.

Usage

myListBox.getItemAt(index)

Parameters

index An integer specifying the index of the item to retrieve.

Returns

An object or undefined.

Description

Method; returns the item at the specified index as an object with the properties label and data. If there is no item at the specified index, the method returns undefined.

The ListBox component uses a zero-based index, where the item at index 0 is displayed at the top of the list.

Example

The following code returns the label of the item at index 4 in listMenu1 to the Output window.

trace(listMenu1.getItemAt(4).label);

The following code returns the data or value associated with the item at index 4 in listMenu2 to the Output window.

trace(listMenu2.getItemAt(4).data);

The following code returns an object containing the label and data value associated with the item at index 4 in listMenu3 to the Output window.

trace(listMenu3.getItemAt(4));

See also

FListBox.getSelectedItem