MACROMEDIA FLEX-CREATING ADVANCED COMPONENTS Manual page 7

Creating advanced components
Table of Contents

Advertisement

Note: Macromedia recommends that you base your components on the UIComponent class rather
than the UIObject class. The UIComponent class provides more built-in functionality, but maintains
the flexibility of extending the UIObject class.
UIObject and UIComponent are the base classes of the component architecture. Understanding
the principles at work in these two classes is important for building components.
The following table briefly describes the two base classes:
Class
mx.core.UIComponent
mx.core.UIObject
About the UIObject and UIComponent classes
Components based on version 2 of the Macromedia Component Architecture descend from the
UIObject class, which wraps the MovieClip class. The MovieClip class is the base class for the
classes in Flash that can draw on the screen. By providing a wrapper around its methods and
properties, Flex makes the UIObject syntax more intuitive and improves the conceptual
management of representing graphic objects.
The UIObject (mx.core.UIObject) class hides the mouse handling and frame handling in the
MovieClip class. The UIObject class also defines the styles, skins, and event aspects of the
component architecture. The UIObject class and its subclasses broadcast their events just before
drawing. If you are familiar with Flash, this event is analogous to the
event. The UIObject class posts events to its listeners just before drawing when loading and
unloading, and when its layout changes (
A UIObject class or UIObject subclass resizes itself by scaling. When you change its size using the
method, the new dimensions are passed to the
setSize()
MovieClip class, which scale the subclass.
Extends
Description
UIObject
UIComponent is the base class for all Flex components. It can
participate in tabbing, accept low-level events such as keyboard
and mouse input, and be disabled so it does not receive mouse
and keyboard input.
The UIComponent class lets you perform the following tasks:
• Create focus navigation
• Enable and disable components
• Resize components
Macromedia recommends using the UIComponent class rather
than the UIObject class as the base class for your custom
components.
MovieClip UIObject is the base class for all graphical objects. It can have
shape, draw itself, and be invisible.
The UIObject class lets you perform the following tasks:
• Edit styles
• Handle events
• Resize by scaling
Macromedia does not recommend using the UIObject class
rather than the UIComponent class as the base class for your
custom components.
move
,
).
resize
and
_width
Writing the component's ActionScript code
MovieClip
enterFrame()
properties of the
_height
7

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents