-
最简单的方法改变combobox的样式 - [flash学习笔记]2009-09-16
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://crazyrabbit.blogbus.com/logs/46614588.html
两个类文件CustomCellRenderer.as 和CustomComboBox.as
package com.rockabit.utils.as3
{
import fl.controls.listClasses.CellRenderer;
import flash.text.TextFormat;
/**
* Custom cellRenderer for comboBox list items.
*/
public class CustomCellRenderer extends CellRenderer
{
public function CustomCellRenderer()
{
super();
this.setStyle('embedFonts', true);
this.setStyle('textFormat', new TextFormat(new tahoma().fontName, 14, 0x000000));
}
}
}类文件2
package com.rockabit.utils.as3
{
import fl.controls.ComboBox;
import fl.controls.List;
import flash.text.TextFormat;
/**
* Customized ComboBox component. Graphic changes have been made inside the component itself,
* in the library, changes in textual display are made here.
*/
public class CustomComboBox extends ComboBox
{
private var textFormat:TextFormat;
public function CustomComboBox()
{
super();
textFormat = new TextFormat(new tahoma().fontName, 11, 0x000000);
//textField is the top text, in the closed combobox
textField.setStyle('embedFonts', true);
textField.setStyle('textFormat', textFormat);
//dropdown is the list that shows when you open the combobox
dropdown.setStyle('cellRenderer', CustomCellRenderer);
}
}
}这个类文件扩展combobox,
拖一个combobox到库中,然后,右键属性把类改成CustomComboBox,只是要注意路径要正确
随机文章:
flash as3.0 打字机效果 2009-12-02flash技巧之代码提示 2009-09-17从美的原则谈网页上的艺术表现 2009-02-26如何解决用mc做按钮时,里面的动态文本框无法点击问题 2008-07-31如何将外部xml作为DataGrid 的数据源 2008-03-26
收藏到:Del.icio.us







