我在电影的主时间线中有一个列表组件,并且...
var tf:TextFormat = new TextFormat();
tf.color = xmlData.config.playList.@textColor;
StyleManager.setStyle("textFormat", tf);
上面的代码工作正常,但为什么这不起作用?
StyleManager.setComponentStyle(List, "textFormat", tf);
我在电影的主时间线中有一个列表组件,并且...
var tf:TextFormat = new TextFormat();
tf.color = xmlData.config.playList.@textColor;
StyleManager.setStyle("textFormat", tf);
上面的代码工作正常,但为什么这不起作用?
StyleManager.setComponentStyle(List, "textFormat", tf);
调整了CellRenderer 类。
CellRenderer 类定义了基于列表的组件的方法和属性,用于在它们的每一行中操作和显示自定义单元格内容。自定义单元格可以包含文本、现有组件(如 CheckBox)或您创建的任何类。使用此类的基于列表的组件包括 List、DataGrid、TileList 和 ComboBox 组件。
CustomCellRenderer.as
您首先创建了一个名为CustomCellRenderer
(File > New > ActionSript File) 的类。
package com
{
import fl.controls.listClasses.CellRenderer;
import flash.text.TextFormat;
public class CustomCellRenderer extends CellRenderer
{
public function CustomCellRenderer()
{
setStyle("textFormat", new TextFormat("arial", 10, 0xFF00FF));
}
}
}
我的Fla.fla
如果要将 textFormat 应用于类 List 的实例 myList:
import com.CustomCellRenderer;
myList.setStyle("cellRenderer", CustomCellRenderer);
如果要将 textFormat 应用于类 List 的所有实例:
import com.CustomCellRenderer;
import fl.managers.StyleManager;
StyleManager.setComponentStyle(List, "cellRenderer", CustomCellRenderer);
关于CellRenderer的Adobe 帮助。