DataSet.newItem

Availability

Flash Player 7.

Edition

Flash MX Professional 2004.

Usage

Usage 1:

var listenerObject:Object = new Object();
listenerObject.newItem = function (eventObj:Object) {
    // ...
};
dataSetInstance.addEventListener("newItem", listenerObject);

Usage 2:

on (newItem) {
    // ...
}

Description

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.

Example

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