Macromedia flex 2 Manual

Page of 254
148
Creating Advanced Visual Components in ActionScript
You usually create a component as a subclass of an existing class. For example, to create a 
component that is based on the Button control, you create a subclass of the 
mx.controls.Button class. To make your own component, you create a subclass of the 
mx.core.UIComponent class. 
About overriding protected UIComponent methods
All Flex visual components are subclasses of the 
UIComponent
 class. Therefore, visual 
components inherit the methods, properties, events, styles, and effects defined by the 
UIComponent class. 
To create an advanced visual component, you must implement a class constructor. Also, you 
optionally override one or more of the following protected methods of the UIComponent 
class:
UIComponent 
method
Description
commitProperties()
Commits any changes to component properties, either to make the 
changes occur at the same time, or to ensure that properties are set in 
a specific order.
For more information, see 
.
createChildren()
Creates any child components of the component. For example, the 
ComboBox control contains a TextInput control and a Button control 
as child components. 
For more information, see 
.
layoutChrome()
Defines the border area around the container for subclasses of the 
Container class. 
For more information, see 
.
measure()
Sets the default size and default minimum size of the component. 
For more information, see 
.
updateDisplayList()
Sizes and positions the children of the component on the screen based 
on all previous property and style settings, and draws any skins or 
graphic elements used by the component. The parent container for the 
component determines the size of the component itself.
For more information, see 
.