datagrid中修改背景颜色式样

以下转载官方文档
//http://www.adobe.com/devnet/flash/quickstart/datagrid_pt3.html

啥都不多说了,老外的文档注释说得已经很详细了。直接上代码
package {
// Import the required component classes.
import fl.controls.listClasses.CellRenderer;
import fl.controls.listClasses.ICellRenderer;

/** * This class sets the upSkin style based on the current item's index in a list.
* Make sure the class is marked "public" and in the case of our custom cell renderer, * extends the CellRenderer class and implements the ICellRenderer interface. */

public class AlternatingRowColors extends CellRenderer implements ICellRenderer {
/** * Constructor. */
public function AlternatingRowColors():void {
super();
}

/** * This method returns the style definition object from the CellRenderer class. */
public static function getStyleDefinition():Object
{
return CellRenderer.getStyleDefinition();
}

/** * This method overrides the inherited drawBackground() method and sets the renderer's * upSkin style based on the row's current index. For example, if the row index is an * odd number,the upSkin style is set to the CellRenderer_upSkinDarkGray linkage in the * library. If the row index is an even number, the upSkin style is set to the * CellRenderer_upSkinGray
linkage in the library.
*/
override protected function drawBackground():void {
if (_listData.index % 2 == 0) {
setStyle("upSkin", CellRenderer_upSkinGray);
}
else{
setStyle("upSkin", CellRenderer_upSkinDarkGray);
}
super.drawBackground();
}
}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值