读书人

Flex 4.5 运用ActionScript创建item r

发布时间: 2012-10-07 17:28:51 作者: rapoo

Flex 4.5 使用ActionScript创建item renderer

?

使用AS创建item renderer
有以下方法用于创建AS item render:创建现有item renderer的子类,比如spark.components.LabelItemRenderer,spark.components.IconItemRenderer,或者spark.components.supportClasses.ItemRenderer。使用spark.components.LabelItemRenderer可以获得最高的性能。在子类中可以控制背景显示和数据项的布局。如果想使用Flex的内建布局机制,且不是很在意性能,就创建spark.components.supportClasses.ItemRenderer的子类。创建mx.core.UIComponent的子类。可以获得最好的性能,需要实现mx.core.IDataRenderer和spark.components.IItemRenderer接口。
实现一个item renderer需要覆盖必要的方法,和调用必要的invalidation方法,具体取决于继承的父类。可选的覆盖以下方法:

Commits any changes to component properties, either to make the changes occur at the same time or to ensure that properties are set in a specific order.

For more information, see?Implementing the commitProperties() method.

Creates any child components of the component. For example, the ComboBox control contains a TextInput control and a Button control as child components.

For more information, see?Implementing the createChildren() method.

Sets the default size and default minimum size of the component.

For more information, see?Implementing the measure() method.

Detects changes to style properties.

For more information, see?Overriding the styleChanged() method.

Sizes and positions the children of the component on the screen based on all previous property and style settings, and draws any skins or graphic elements used by the component. The parent container for the component determines the size of the component itself.

Defines the background display of the item renderer.

Lays out the children of the item renderer.

Marks a component so that its?

Marks a component so that its?

Marks a component so that its?

读书人网 >flex

热点推荐