User Guide
Collection interface (Flash Professional only) 169
Collection interface (Flash Professional only)
ActionScript Class Name mx.utils.Collection
The collection class is distributed in the common classes library as a compiled clip symbol. To
access this class, select Window > Other Panels > Common Libraries > Classes > UtilsClasses.
The collection interface lets you programmatically manage a group of related items, called
collection items. Each collection item in this set has properties that are described in the metadata of
the collection item class definition.
Components can expose properties as collections, which you can manipulate while authoring by
using the Values dialog box from the Component inspector. Using this dialog box, you can add
items, remove items, change properties of items, and change the position of items within the
collection. For more information on collections and collection items, see “About the Collection
tag” on page 942.
You typically use the collection interface with components that use the Collection metadata tag to
create collection properties. Although you can create, access, and delete Collection instances
programmatically, collections are most often used in the context of a component. Flash MX
Professional 2004 provides implementations of both collection-related interfaces (CollectionImpl
for Collection, and IteratorImpl for Iterator).
Method summary for the Collection interface
The following table lists the methods of the Collection interface.
Collection.addItem()
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
collection.addItem(item)
Method Description
Collection.addItem() Adds a new item to the end of the collection.
Collection.contains() Indicates whether the collection contains the specified item.
Collection.clear() Removes all elements from the collection.
Collection.getItemAt() Returns an item within the collection by using its index.
Collection.getIterator() Returns an iterator over the elements in the collection.
Collection.getLength() Returns the number of items in the collection.
Collection.isEmpty() Indicates whether the collection is empty.
Collection.removeItem() Removes the specified item from the collection.
CHAPTER 6
Components Dictionary