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.

The following table describes the invalidation methods:

Invalidation method

Description

invalidateProperties()

Marks a component so that its commitProperties() method gets called during the next screen update.

invalidateSize()

Marks a component so that its measure() method gets called during the next screen update.

invalidateDisplayList()

Marks a component so that its layoutChrome() and updateDisplayList() methods get called during the next screen update.

When a component calls an invalidation method, it signals to Flex that the component must be updated. When multiple components call invalidation methods, Flex coordinates updates so that they all occur together during the next screen update.

Typically, component users do not call the invalidation methods directly. Instead, they are called by the component's setter methods, or by any other methods of a component class as necessary. For more information and examples, see Implementing the commitProperties() method.


Flex 2

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/2/docs/00001724.html