User Guide
340 Components Dictionary
See also
DataSet.removeItem
DataSet.addItem()
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
dataSetInstance.addItem([obj])
Parameters
obj An object to add to this collection. This parameter is optional.
Returns
A Boolean value: true if the item was added to the collection, false if it was not.
Description
Method; adds the specified record (transfer object) to the collection for management. The
newly added item becomes the current item of the data set. If no
obj parameter is specified, a
new object is created automatically by means of
DataSet.createItem().
The location of the new item in the collection depends on whether a sort has been specified
for the current iterator. If no sort is in use, the item is added to the end of the collection. If a
sort is in use, the item is added to the collection according to its position in the current sort.
For more information on initialization and construction of the transfer object, see
DataSet.createItem().
Example
The following example uses DataSet.addItem() to create a new item and add it to the
data set:
my_ds.addEventListener("addItem", addItemListener);
my_ds.addItem({name:"Bobo", occupation:"clown"});
function addItemListener(evt_obj:Object):Void {
trace("adding item");
}