Can any one tell me about
what is the Difference between validateProperties()
and invalidateProperties()
?
问题:
回答1:
invalidateProperties:
Marks a component so that its commitProperties() method gets called during a later screen update.
Invalidation is a useful mechanism for eliminating duplicate work by delaying processing of changes to a component until a later screen update. For example, if you want to change the text color and size, it would be wasteful to update the color immediately after you change it and then update the size when it gets set. It is more efficient to change both properties and then render the text with its new size and color once.
Invalidation methods rarely get called. In general, setting a property on a component automatically calls the appropriate invalidation method.
validateProperties:
Used by layout logic to validate the properties of a component by calling the commitProperties() method. In general, subclassers should override the commitProperties() method and not this method.
Essentially, validate calls commitProperties directly while invalidate waits for the next frame to do it. Always use invalidate.
回答2:
From: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/IInvalidating.html#invalidateProperties%28%29
invalidateProperties()
public function invalidateProperties():void
Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1
Calling this method results in a call to the component's validateProperties()
method before the display list is rendered.