User Guide

About creating advanced components 153
You can remove a component from a container by using the removeChild() method. If there
are no references to the component, it is eventually deleted from memory by the garbage
collection mechanism of Adobe Flash Player 9.
About the steps for creating a component
When you implement a component, you override component methods, define new
properties, dispatch new events, or perform any other customizations required by your
application.
To implement your component, Follow these general steps:
1. If necessary, create any skins for the component.
2. Create an ActionScript class file.
a. Extend one of the base classes, such as UIComponent or another component class.
b. Specify properties that the user can set by using an MXML tag property. For more
information, see Chapter 9, “Creating Simple Visual Components in ActionScript,
on page 121.
c. Embed any graphic and skin files. For more information, see Chapter 9, “Creating
Simple Visual Components in ActionScript,” on page 121.
d. Implement the constructor.
e. Implement the UIComponent.createChildren() method.
f. Implement the UIComponent.commitProperties() method.
g. Implement the UIComponent.measure() method.
h. Implement the UIComponent.layoutChrome() method.
i. Implement the UIComponent.updateDisplayList() method.
j. Add properties, methods, styles, events, and metadata.
3. Deploy the component as an ActionScript file or as a SWC file.
You do not have to override all component methods to define a new component. You only
override the methods required to implement the functionality of your component. If you
create a subclass of an existing component, such as Button control or VBox container, you
must implement the methods necessary for you to add any new functionality to the
component.