User Guide
Selecting a parent class 137
Understanding the UIObject class
Components based on version 2 of the Macromedia Component Architecture descend from
the UIObject class, which is a subclass of the MovieClip class. The MovieClip class is the base
class for all classes in Flash that represent visual objects on the screen.
UIObject adds methods that allow you to handle styles and events. It posts events to its
listeners just before drawing (the
draw event is the equivalent of the
MovieClip.onEnterFrame event), when loading and unloading (load and unload), when its
layout changes (
move, resize), and when it is hidden or revealed (hide and reveal).
UIObject provides alternate read-only variables for determining the position and size of a
component (
width, height, x, y), and the move() and setSize() methods to alter the
position and size of an object.
The UIObject class implements the following:
■ Styles
■ Events
■ Resize by scaling
Understanding the UIComponent class
The UIComponent class is a subclass of UIObject (see UIComponent class in Components
Language Reference). It is the base class of all components that handle user interaction (mouse
and keyboard input). The UIComponent class allows components to do the following:
■ Receive focus and keyboard input
■ Enable and disable components
■ Resize by layout
About extending other version 2 classes
To make component construction easier, you can extend any class; you are not required to
extend the UIObject or UIComponent class directly. If you extend any other version 2
component’s class (except the Media components), you extend UIObject and UIComponent
by default. Any component class listed in the Component dictionary can be extended to
create a new component class.
For example, if you want to create a component that behaves almost the same as a Button
component does, you can extend the Button class instead of re-creating all the functionality of
the Button class from the base classes.