Collection class (Flash Professional only)

ActionScript Class Name mx.utils.Collection

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 in Using Components.

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.

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.


Version 8

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00003153.html