User Guide

152 Creating Advanced Visual Components in ActionScript
f. Dispatches the initialize event on the component. At this time, all of the
component’s children are initialized, but the component was not sized or processed for
layout. You can use this event to perform additional processing of the component
before it is laid out.
g. Dispatches the childAdd event on the parent container.
h. Dispatches the initialize event on the parent container.
4. During the next render event, Flex performs the following actions:
a. Calls the components commitProperties() method.
b. Calls the component’s measure() method.
c. Calls the component’s layoutChrome() method.
d. Calls the component’s updateDisplayList() method.
e. Dispatches the updateComplete event on the component.
5. Flex dispatches additional render events if the commitProperties(), measure(), or
updateDisplayList() methods call the invalidateProperties(),
invalidateSize(), or invalidateDisplayList() methods.
6. After the last render event occurs, Flex performs the following actions:
a. Makes the component visible by setting the visible property to true.
b. Dispatches the creationComplete event on the component. The component is sized
and processed for layout. This event is only dispatched once when the component is
created.
c. Dispatches the updateComplete event on the component. Flex dispatches additional
updateComplete events whenever the layout, position, size, or other visual
characteristic of the component changes and the component is updated for display.
Most of the work for configuring a component occurs when you add the component to a
container by using the
addChild() method. That is because until you add the component to
a container, Flex cannot determine its size, set inheriting style properties, or draw it on the
screen.
You can also define your application in MXML, as the following example shows:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Box>
<mx:Button label="Submit"/>
</mx:Box>
</mx:Application>
The sequence of steps that Flex executes when creating a component in MXML are equivalent
to the steps described for ActionScript.