Flash CS3 Documentation |
|||
| Using ActionScript 2.0 Components > Creating Components > Overview of component structure | |||
A component consists of a Flash (FLA) file and an ActionScript (AS) file. You can optionally create and package other files (for example, an icon and a .swd debugging file) with your component, but all components require a FLA and an ActionScript file. When you've finished developing your component, you export it as a SWC file.
A Flash (FLA) file, an ActionScript (AS) file, and a SWC file
The FLA file contains a movie clip symbol that must be linked to the AS file in both the Linkage Properties and the Component Definition dialog boxes.
The movie clip symbol 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; Frame 2 contains all other assets, including graphics and base classes, used by the component.
The ActionScript code specifying the properties and methods for the component is in a separate ActionScript class file. This class file also declares which, if any, classes the component extends. The name of the AS class file is the name of the component plus the ".as" extension. For example, MyComponent.as contains the source code for the MyComponent component.
It's a good idea to save the component's FLA and AS files in the same folder and give them the same name. If the AS file is not saved in the same folder, you must verify that the folder is in the classpath so the FLA file can find it. For more information about the classpath, see Classes in Learning ActionScript 2.0 in Adobe Flash.
Flash CS3