User Guide

DataSet component (Flash Professional only) 339
DataSet.removeItem
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
on(removeItem) {
// insert your code here
}
listenerObject = new Object();
listenerObject.removeItem = function (eventObj) {
// insert your code here
}
dataSet.addEventListener("removeItem", listenerObject)
Description
Event; generated just before a new item is deleted from this collection.
If you set the
result property of the event object to false, the delete operation is canceled; if
you set it to
true, the delete operation is allowed.
The event object (
eventObj) contains the following properties:
target The DataSet object that generated the event.
type The string "removeItem".
item A reference to the item in the collection to be removed.
result A Boolean value that specifies whether the item should be removed. By default, this
value is
true.
Example
In this example, an on(removeItem) event handler cancels the deletion of the new item if a
user-defined function named
userHasAdminPrivs() returns false; otherwise, the deletion
is allowed.
on(removeItem) {
if(globalObj.userHasAdminPrivs()) {
// Allow the item deletion.
eventObj.result = true;
} else {
// Don’t allow item deletion; user doesn’t have admin privileges.
eventObj.result = false;
}
}
See also
DataSet.addItem