F > FListBox.replaceItemAt

 

FListBox.replaceItemAt

Availability

Flash Player 6.

Usage

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

Parameters

index An integer specifying the position of a list item.

label A string specifying a new label for the list item.

data The new value to associate with the list item. This parameter is optional; if you don't specify it, any data currently associated with the item remains in place.

Returns

Nothing.

Description

Method; updates the item at the specified index with the specified label and data. If the item at the specified index has an associated data value and you do not specify a value for the Data parameter, the data value of the list item is not changed.

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

Example

The following code updates the fifth item in the list box Favorites with the new label Lucky and new value Cat. If the data value Cat were not specified, and the data associated with the fifth list item were Dog, then the data value for Lucky would be Dog (which would be wrong because she is a cat).

Favorites.replaceItemAt(4, "Lucky", "Cat");

See also

FListBox.addItemAt, FListBox.getItemAt