Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > DataSet component > DataSet.removeItem() | |||
Flash Player 7.
Flash MX Professional 2004.
dataSetInstance.removeItem([item])
item The item to be removed. This parameter is optional.
A Boolean value. Returns true if the item was successfully removed; otherwise, returns false.
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.
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
DataSet.deltaPacket, DataSet.logChanges
Flash CS3