Macromedia flex 2 Manual

Page of 254
About creating advanced components
149
Component users do not call these methods directly; Flex calls them as part of the 
initialization process of creating a component, or when other method calls occur. For more 
information, see 
About the invalidation methods
During the lifetime of a component, your application might modify the component by 
changing its size or position, modifying a property that controls its display, or modifying a 
style or skin property of the component. For example, you might change the font size of the 
text displayed in a component. As part of changing the font size, the component’s size might 
also change, which requires Flex to update the layout of the application. The layout operation 
might require Flex to invoke the 
commitProperties()
measure()
layoutChrome()
, and 
the 
updateDisplayList()
 methods of your component. 
Your application can programmatically change the font size of a component much faster than 
Flex can update the layout of an application. Therefore, you only want to update the layout 
after you are sure that you determined the final value of the font size.
In another scenario, when you set multiple properties of a component, such as the 
label
 and 
icon
 properties of a Button control, you want the 
commitProperties()
measure()
, and 
updateDisplayList()
 methods to execute only once, after all properties are set. You do not 
want these methods to execute when you set the 
label
 property, and then execute again when 
you set the 
icon
 property.
Also, several components might change their font size at the same time. Rather than updating 
the application layout after each component changes its font size, you want Flex to coordinate 
the layout operation to eliminate any redundant processing. 
Flex uses an invalidation mechanism to synchronize modifications to components. Flex 
implements the invalidation mechanism as a set of methods that you call to signal that 
something about the component has changed and requires Flex to call the component’s 
commitProperties()
measure()
layoutChrome()
, or 
updateDisplayList()
 methods.