User Guide
Implementing the component 167
A component does not appear on the screen until its updateDisplayList() method gets
called. Flex schedules a call to the
updateDisplayList() method when a call to the
invalidateDisplayList() method occurs. The updateDisplayList() method executes
during the next
render event after a call to the invalidateDisplayList() method. When
you use the
addChild() method to add a component to a container, Flex automatically calls
the
invalidateDisplayList() method.
The main uses of the
updateDisplayList() method are the following:
■ Sets the size and position of the elements of the component for display.
Many components are made up of one or more child components, or have properties that
control the display of information in the component. For example, the Button control lets
you specify an optional icon, and use the
labelPlacement property to specify where the
button text appears relative to the icon.
The
Button.updateDisplayList() method uses the settings of the icon and
labelPlacement properties to control the display of the button.
For containers that have child controls, the
updateDisplayList() method controls how
those child components are positioned. For example, the
updateDisplayList() method
on the HBox container positions its children from left to right in a single row; the
updateDisplayList() method for a VBox container positions its children from top to
bottom in a single column.
To size components in the
updateDisplayList() method, you use the
setActualSize() method, not the sizing properties, such as width and height. To
position a component, use the
move() method, not the x and y properties.
■ Draws any visual elements necessary for the component.
Components support many types of visual elements such as skins, styles, and borders.
Within the
updateDisplayList() method, you can add these visual elements, use the
Flash drawing APIs, and perform additional control over the visual display of your
component.
The
updateDisplayList() method has the following signature:
protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void