Defining A Collection Property; Simple Collection Example - MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

This appendix contains the following sections:

Defining a collection property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 960

Simple collection example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 960

Defining the class for a collection item. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 962
Accessing collection information programmatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963
Exporting components that have collections to SWC files . . . . . . . . . . . . . . . . . . . . . . . . . . . 964
Using a component that has a collection property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965
Defining a collection property
You define a collection property by using the Collection tag in a component's ActionScript file.
For more information, see
Note: This section assumes that you know how to create components and inspectable component
properties.
To define a collection property:
Create a FLA file for your component.
1.
See
"Creating a component movie clip" on page
Create an ActionScript class.
2.
See
"Creating the ActionScript class file" on page
In the ActionScript class, insert a Collection metadata tag.
3.
For more information, see
Define
and
4.
get
Add the utilities classes to your FLA file by selecting Windows > Other Panels > Common
5.
Libraries > Classes and dragging UtilsClasses into the component's library.
UtilsClasses contains the mx.utils.* package for the Collection interface.
Note: Because UtilsClasses is associated with the FLA file, not the ActionScript class, Flash
throws compiler errors when you check syntax while viewing the component's ActionScript class.
Code a class that contains the collection item properties.
6.
See
"Defining the class for a collection item" on page
Simple collection example
The following is a simple example of a component class file called MyShelf.as. This example
contains a collection property along with a minimal set of imports, methods, and declarations for
a component that inherits from the UIObject class.
If you import mx.utils.* in this example, the class names from mx.utils no longer need to be fully
qualified. For instance, mx.utils.Collection can be written Collection.
import mx.utils.*;
// standard class declaration
960
Appendix: Collection Properties
"About the Collection tag" on page
"About the Collection tag" on page
methods for the collection in the component's ActionScript file.
set
942.
927.
930.
942.
962.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents