DataSet.removeItem()

Availability

Flash Player 7.

Edition

Flash MX Professional 2004.

Usage

dataSetInstance.removeItem([item])

Parameters

item The item to be removed. This parameter is optional.

Returns

A Boolean value. Returns true if the item was successfully removed; otherwise, returns false.

Description

Method; removes the specified item from the collection, or removes the current item if the item parameter is omitted. This operation is logged to DataSet.deltaPacket if DataSet.logChanges is true.

Example

The following code removes the item at the current iterator position. To test this example, add a DataSet component to the Stage, and give it an instance name of my_ds. Add the following code to Frame 1 of the main timeline:

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});

trace(my_ds.getLength()); // 5
trace(my_ds.currentItem.name); // Frank
my_ds.removeItem(); 
trace(my_ds.getLength()); // 4
trace(my_ds.currentItem.name); // Michael

See also

DataSet.deltaPacket, DataSet.logChanges


Flash CS3