User Guide

125
6
CHAPTER 6
Creating Components
This chapter describes how to create your own component and package it for distribution.
This chapter contains the following sections:
Component source files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Overview of component structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Building your first component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Selecting a parent class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Creating a component movie clip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Creating the ActionScript class file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Incorporating existing components within your component . . . . . . . . . . . . . . . . . . . 173
Exporting and distributing a component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Final steps in component development. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Component source files
The components available in the Components panel are precompiled SWC clips. The source
Flash Document (FLA) containing the graphics and the source ActionScript class files (AS)
containing the code for these components have also been provided for you to use in creating
your own custom components. The source files for the version 2 components are installed
with Macromedia Flash. It is helpful to open and review a few of these files, and try to
understand their structure before you build your own components. The RadioButton
component is a good example of a simpler component that you may want to explore first. All
the components are symbols in the library of StandardComponents.fla. Each symbol is linked
to an ActionScript class. Their location is as follows:
FLA file source code
In Windows: C:\Program Files\Macromedia\
Flash 8\language\Configuration\ComponentFLA\StandardComponents.fla.
On the Macintosh: HD/Applications/Macromedia Flash 8/Configuration/
ComponentFLA/StandardComponents.fla