F > FListBox.addItemAt

 

FListBox.addItemAt

Availability

Flash Player 6.

Usage

myListBox.addItemAt(index, label [, data])

Parameters

index An integer specifying the index position at which to add the item.

label A text string specifying the label of the item.

data A value associated with the list item. This parameter is optional.

Returns

Nothing.

Description

Method; adds a new item with the specified label and associated data (optional) at the specified index and updates the list box. The Data parameter can be any Flash object, string, Boolean, integer, object, or movie clip.

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

For best performance and load-time results, do not add more than 400 items in a single frame. This applies whether you are adding the items to a single list box or to several list boxes.

Example

The following code adds the item Dave with an associated value of friend as the fifth item in list box peopleList.

peopleList.addItemAt(4, "Dave", friend);

For examples of loading a large number of items, see FListBox.addItem.

See also

FListBox.getSelectedItem, FListBox.removeItemAt, FListBox.replaceItemAt, FListBox.sortItemsBy