User Guide
170 Chapter 6: Components Dictionary
Parameters
item
The object to be added to the collection. If item is null, it is not added to the collection.
Returns
A Boolean value of true if the collection was changed as a result of the operation.
Description
Method; adds a new item to the end of the collection.
Example
The following example calls addItem():
on (click) {
import CompactDisc;
var myColl:mx.utils.Collection;
myColl = _parent.thisShelf.MyCompactDiscs;
myCD = new CompactDisc();
myCD.Artist = "John Coltrane";
myCD.Title = "Giant Steps";
var wasAdded:Boolean = myColl.addItem(myCD);
}
Collection.contains()
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
collection.contains(item)
Parameters
item
The object whose presence in the collection is to be tested.
Returns
A Boolean value of true if the collection contains item.
Description
Method; indicates whether the collection contains the specified item. For Flash to consider the
objects as equal, they must refer to the same object. If
item is a different object,
Collection.contains() returns false, even if the object’s properties are all equal.