User Guide

314 Chapter 6: Components Dictionary
DataSet.createItem()
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
dataSet.createItem([itemData])
Parameters
itemData
Data associated with the item. This parameter is optional.
Returns
The newly constructed item.
Description
Method; creates an item that isn’t associated with the collection. You can specify the class of object
created by using the
DataSet.itemClassName property. If no DataSet.itemClassName value is
specified and the
itemData parameter is omitted, an anonymous object is constructed. This
anonymous object’s properties are set to the default values based on the schema currently specified
by
DataSet.schema.
When this method is invoked, any listeners for the
DataSet.newItem event are notified and are
able to manipulate the item before it is returned by this method. The optional item data is used to
initialize the class specified with the
DataSet.itemClassName property or is used as the item if
DataSet.itemClassName is blank.
A
DataSetError exception is thrown when the class specified with the DataSet.itemClassName
property cannot be loaded.
Example
contact.itemClassName = "Contact";
var itemData = new XML("<contact_info><name>John Smith</
name><phone>555.555.4567</phone><zip><pre>94025</pre><post>0556</post></
zip></contact_info>");
contact.addItem(contact.createItem(itemData));
See also
DataSet.itemClassName
, DataSet.newItem, DataSet.schema
DataSet.currentItem
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.