Collection Properties

When you create a new custom component in Flash, you can make property values available for editing by the user. These properties are called collection properties. The property values can be edited by the user in the Values dialog box (opened from a text box within the Parameters tab for your component).

Components usually include functionality for a specific task, while remaining flexible for a range of requirements by the component user. For a component to be flexible, the properties within the component need to be flexible (in other words, for some components, the properties can be changed by the component user, as well as by the property values).

Collection properties enable you to create an indeterminate number of editable properties in an object model. Flash provides a Collection class to help you manage those properties through the Component inspector.

Specifically, the Collection class is a helper class used to manage a group of related objects, each called a collection item. If you define a property of your component as a collection item and make it available to users through the Component inspector, they can add, delete, and modify collection items in the Values dialog box while authoring.


The Values dialog box

You define collections and collection items as follows:

In Flash, Collections make it easier for you to manage groups of related items programmatically. (In previous versions of Flash, component authors managed groups of related items through multiple programmatically synchronized arrays).

In addition to the Values dialog box, Flash provides the Collection and Iterator interfaces to manage Collection instances and values programmatically. See Collection interface and Iterator interface in ActionScript 2.0 Components Language Reference.

This chapter contains the following sections:

Defining a collection property
Simple collection example
Defining the class for a collection item
Accessing collection information programmatically
Exporting components that have collections to SWC files
Using a component that has a collection property

Flash CS3


 

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

Current page: http://livedocs.adobe.com/flash/9.0/main/00002527.html