DataSet.addItemAt()

Availability

Flash Player 7.

Edition

Flash MX Professional 2004.

Usage

dataSetInstance.addItemAt(index, item)

Parameters

index A number greater than or equal to 0. This number indicates the position at which to insert the item; it is the index of the new item.

item An object containing the data for the item.

Returns

A Boolean value indicating whether the item was added: true indicates that the item was added, and false indicates that the item already exists in the data set.

Description

Method; adds a new item to the data set at the specified index. Indices greater than the data provider's length are ignored.

This method triggers the modelChanged event with the event type addItem.

Example

The following example uses the addItemAt() method to add an item to the DataSet at the first position:

my_ds.addItem({name:"Milton", years:3});
my_ds.addItem({name:"Mark", years:3});
my_ds.addItem({name:"Sarah", years:1});
my_ds.addItem({name:"Michael", years:2});
my_ds.addItem({name:"Frank", years:2});
my_ds.addItemAt(0, {name:"Bobo", years:1});

Flash CS3