Difference between validateProperties() and invalidateProperties()

余生长醉 提交于 2019-12-22 13:57:21

问题


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.



来源:https://stackoverflow.com/questions/7185594/difference-between-validateproperties-and-invalidateproperties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!