Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > DataSet component > DataSet.newItem | |||
Flash Player 7.
Flash MX Professional 2004.
Usage 1:
var listenerObject:Object= new Object();listenerObject.newItem = function (eventObj:Object) { // ... };dataSetInstance.addEventListener("newItem",listenerObject);
Usage 2:
on (newItem) {
// ...
}
Event; broadcast when a new transfer object is constructed by means of DataSet.createItem(). A listener for this event can make modifications to the item before it is added to the collection.
The event object (eventObj) contains the following properties:
target The DataSet object that generated the event.
type The string "iteratorScrolled".
item A referenece to the item that was created.
The following example makes modifications to a newly created item before it's added to the collection:
function newItemEvent(evt_obj:Object):Void {
var employee:Object = evt_obj.item;
employee.name = "newGuy";
// Property data happens to be XML.
employee.zip = employee.getPropertyData().firstChild.childNodes[1].attributes.zip;
}
employees_ds.addEventListener("newItem", newItemEvent);
Flash CS3