Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > DataSet component > DataSet.addItemAt() | |||
Flash Player 7.
Flash MX Professional 2004.
dataSetInstance.addItemAt(index,item)
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.
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.
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.
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