List.addItemAt()

Availability

Flash Player 6.0.79.

Edition

Flash MX 2004.

Usage

listInstance.addItemAt(index, label[, data])
listInstance.addItemAt(index, itemObject)

Parameters

label A string that indicates the label for the new item.

data The data for the item. This parameter is optional and can be any data type.

index A number greater than or equal to zero that indicates the position of the item.

itemObject An item object that usually has label and data properties.

Returns

The index at which the item was added.

Description

Method; adds a new item to the position specified by the index parameter.

In the first usage example, an item object is always created with the specified label property, and, if specified, the data property.

The second usage example adds the specified item object.

Calling this method modifies the data provider of the List component. If the data provider is shared with other components, those components will update as well.

Example

The following line of code adds an item to the third index position, which is the fourth item in the list:

myList.addItemAt(3,{label:'Red',data:0xFF0000});