Flash CS3 Documentation |
|||
| Using ActionScript 2.0 Components > Creating Components > Creating a component movie clip | |||
To create a component, you must create a movie clip symbol and link it to the component's class file.
The movie clip has two frames and two layers. The first layer is an Actions layer and has a stop() global function on Frame 1. The second layer is an Assets layer with two keyframes. Frame 1 contains a bounding box or any graphics that serve as placeholders for the final art. Frame 2 contains all other assets, including graphics and base classes, used by the component.
All components are MovieClip objects. To create a new component, you must first insert a new symbol into a new FLA file.
The Create New Symbol dialog box appears.
The class name should be the same as the component name that appears in the Components panel. For example, the Button component's class is mx.controls.Button.
|
NOTE |
|
Do not include the filename's extension; the AS 2.0 Class text box points to the packaged location of the class and not the file system's name for the file. |
If the ActionScript file is in a package, you must include the package name. This value can be relative to the classpath or can be an absolute package path (for example, mypackage.MyComponent).
Flash adds the symbol to the library and switches to symbol-editing mode. In this mode, the name of the symbol appears above the upper-left corner of the Stage, and a cross hair indicates the symbol's registration point.
You can now edit the symbol to create a component. See Editing the movie clip.
After you create the new symbol and define the linkages for it, you can define the component's assets in the symbol's Timeline.
A component's symbol should have two layers. This section describes what layers to insert and what to add to those layers.
stop() function, as follows:stop();
Do not add any graphical assets to this frame.
There are now two blank keyframes in this layer.
To do this, select the symbol from the Components panel and drag it to the Stage. If you are extending a base class, open StandardComponents.fla from the Configuration/ComponentFLA folder and drag the class from the library to the Stage.
|
NOTE |
|
When you drag UIComponent to the component library, the folder hierarchy in the library is changed. If you plan to use your library again, or use it with other groups of components (such as the version 2 components), you should restructure the folder hierarchy to match the StandardComponents.fla library so that it's organized well and you avoid duplicate symbols. |
Any asset that a component uses (whether it's another component or media such as bitmaps) should have an instance placed in the second frame of the Assets layer.
The movie clip symbol must be linked to an ActionScript class file in the Component Definition dialog box. This is how Flash knows where to look for the component's metatags. (For more information about metatags, see Adding component metadata.) There are other options you can select in the Component Definition dialog box as well.
If the class is part of a package, enter the full package name.
This is optional. The best practice is to use the metadata Inspectable tag in the component's class file to specify parameters. When an ActionScript 2.0 class is not specified, define the parameters for the component here.
This is a SWF file that plays in the Component inspector. You can embed it in the component FLA file or browse to an external SWF.
This is an external or embedded SWF file. You don't need to specify a live preview here; you can add a bounding box to the component movie clip, and Flash creates a live preview for you. See Creating a component movie clip.
The Description field was deprecated in Flash MX 2004 because the Reference panel has been removed. This field is provided for backward compatibility when you save FLA files in the Flash MX format.
This option specifies a PNG file to use as an icon for the component. If you specify an IconFile metadata tag in the ActionScript 2.0 class file (best practice), this field is ignored.
When this option is unselected, users can add parameters to each component instance that differ from the component's parameters. Generally, this setting should be selected. This option provides backward compatibility with Flash MX.
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/00002489.html