You want to create a reusable component, such as an interface widget, or even a component without a UI.
Create a new movie clip symbol. On the first frame of the
symbol’s timeline define the component class (which
must inherit from
MovieClip). Then register the
Object.registerClass( ). All this
code should be encapsulated between
Components are a way of encapsulating movie clips so that the
instances can be easily configured by setting parameters through a
user interface at authoring time or through a programmatic interface
at runtime. For those who prefer to use Flash as a design tool, many
ready-made components (such as those included in the Flash UI
Component sets) can be dragged into a movie, and parameters can be
set via the Property inspector or Parameters panel. These components
add functionality to the movie without the designer having to write
all the code that is entailed. For our purposes, however, we will use
the term “component” more
specifically to refer to subclasses of
MovieClip. In other words, we will be discussing
components that are controlled programmatically instead of those that
are controlled via an author-time user interface.
There are five (or six) basic steps to creating a component:
Create a new movie clip symbol and give it a name in the Symbol Property dialog box (accessed under Properties from the Library panel’s pop-up Options ...