![MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Manual Download Page 48](http://html1.mh-extra.com/html/macromedia/flex-developing-components-and-themes/flex-developing-components-and-themes_manual_3388115048.webp)
48
Chapter 3: Creating Advanced Components in Flash MX 2004
7.
Implement the
createChildren()
method.
8.
Implement the
measure()
method.
9.
Implement the
layoutChildren()
method.
10.
Implement the
draw()
method.
11.
Add properties, methods, and metadata.
The ordering of methods that you implement in this process mirrors that in the component
instantiation life cycle. By understanding which methods are called and in what order, you can
better understand how you write a component’s class file. For more information, see
“About the
component instantiation life cycle” on page 51
.
Each of the steps in this process is covered in more detail in the remainder of this chapter.
Selecting a parent class
Most components share some common behavior and functionality. Flash includes two base classes
to supply this commonality: UIObject and UIComponent. By extending these classes, your
components have a basic set of methods, properties, and events.
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
Extends
Description
mx.core.UIComponent 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.
mx.core.UIObject
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.