mx.skins.halo.Defaults这个类包含了flash2004组件的一些全局和个别组件的默认定义,通过对他的修改能很轻松的改变组件的行为和样式。不要紧张先看一下代码,有些加了注释:
static function setThemeDefaults():Void
{
var o = _global.style;
o.themeColor = 0x80ff4d; // "haloGreen" base color
o.disabledColor = 0x848284;
//模式窗口的的背景透明度,如你用alert组件弹出模式窗口是的背景
//默认为全透明
o.modalTransparency = 0;
//是否填充
o.filled = true;
//是否使用画笔
o.stroked = true;
//画笔宽度
o.strokeWidth = 1;
//画笔颜色
o.strokeColor = 0x000000;
//添充颜色
o.fillColor = 0xffffff;
//循环时间
o.repeatInterval = 35; // fast.
//延时
o.repeatDelay = 500; // half second.
//默认字体
o.fontFamily = "_sans";
//字体大小
o.fontSize = 12;
//选择项的背景颜色,在list,combobox等组件中使用
o.selectionColor = 0xCDFFC1;
//移动到项上时的前景色
o.rollOverColor = 0xe3ffd6;
o.useRollOver = true;
o.backgroundDisabledColor = 0xdddddd;
o.selectionDisabledColor = 0xdddddd;
//选择动画的持续时间
o.selectionDuration = 200;
//打开延时
o.openDuration = 250;
//默认边框样式,重要!方便的修改掉难看的边框
//边框样式有"insert","none","solid","alert"等
o.borderStyle = "inset";
//默认字体颜色
o.color = 0xB333C;
//字体选择颜色
o.textSelectedColor = 0x005f33;
//字体over颜色
o.textRollOverColor = 0x2b333c;
//字体无效颜色,其实是组件无效时,里面的字体颜色
o.textDisabledColor = 0xffffff;
//datagrid组件是否有垂直分割线
o.vGridLines = true;
//datagrid组件是否有水平分割线
o.hGridLines = false;
//分割线的颜色
o.vGridLineColor = 0x666666;
o.hGridLineColor = 0x666666;
o.headerColor = 0xeaeaea;
o.indentation = 17;
//tree组件里用的默认图标
o.folderOpenIcon = "TreeFolderOpen";
o.folderClosedIcon = "TreeFolderClosed";
o.defaultLeafIcon = "TreeNodeIcon";
o.disclosureOpenIcon = "TreeDisclosureOpen";
o.disclosureClosedIcon = "TreeDisclosureClosed";
o.popupDuration = 150;
//日历组件当天的颜色
o.todayColor = 0x666666;
// default styles for various classes. other
// properties are set on the ListAssets symbol
//列表项的背景颜色
o = _global.styles.ScrollSelectList = new CSSStyleDeclaration();
o.backgroundColor = 0xffffff;
////列表项的边框颜色
o.borderColor = 0xcacaca;
//边框样式
o.borderStyle = "inset";
//下面是各个组件的具体参数默认定义,自己研究啊
o = _global.styles.ComboBox = new CSSStyleDeclaration();
o.borderStyle = "inset";
o = _global.styles.NumericStepper = new CSSStyleDeclaration();
o.textAlign = "center";
o = _global.styles.RectBorder = new CSSStyleDeclaration();
o.borderColor = 0xd5dddd;
o.buttonColor = 0x6f7777;
o.shadowColor = 0xEEEEEE;
o.highlightColor = 0xc4cccc;
o.shadowCapColor = 0xd5dddd;
o.borderCapColor = 0x919999;
var p = new Object();
p.borderColor = 0xFF0000;
p.buttonColor = 0xFF0000;
p.shadowColor = 0xFF0000;
p.highlightColor = 0xFF0000;
p.shadowCapColor = 0xFF0000;
p.borderCapColor = 0xFF0000;
mx.core.UIComponent.prototype.origBorderStyles = p;
var x;
x = _global.styles.TextInput = new CSSStyleDeclaration();
x.backgroundColor = 0xffffff;
x.borderStyle = "inset";
_global.styles.TextArea = _global.styles.TextInput;
x = _global.styles.Window = new CSSStyleDeclaration();
x.borderStyle = "default";
//styleSheet declared on first frame of WindowAssets
x = _global.styles.windowStyles = new CSSStyleDeclaration();
x.fontWeight = "bold";
//styleSheet declared on first frame of DataGridAssets
x = _global.styles.dataGridStyles = new CSSStyleDeclaration();
x.fontWeight = "bold";
x = _global.styles.Alert = new CSSStyleDeclaration();
x.borderStyle = "alert";
x = _global.styles.ScrollView = new CSSStyleDeclaration();
x.borderStyle = "inset";
x = _global.styles.View = new CSSStyleDeclaration();
x.borderStyle = "none";
x = _global.styles.ProgressBar = new CSSStyleDeclaration();
x.color = 0xAAB3B3;
x.fontWeight = "bold";
x = _global.styles.AccordionHeader = new CSSStyleDeclaration();
x.fontWeight = "bold";
x.fontSize = "11";
x = _global.styles.Accordion = new CSSStyleDeclaration();
x.borderStyle = "solid";
x.backgroundColor = 0xFFFFFF;
x.borderColor = 0x8a938a;
x.headerHeight = 22;
x.marginLeft = x.marginRight = x.marginTop = x.marginBottom = -1;
x.verticalGap = -1;
x = _global.styles.DateChooser = new CSSStyleDeclaration();
x.borderColor = 0x919999;
x.headerColor = 0xffffff;
x = _global.styles.CalendarLayout = new CSSStyleDeclaration();
x.fontSize = 10;
x.textAlign = "right";
x.color = 0x2B333C;
x = _global.styles.WeekDayStyle = new CSSStyleDeclaration();
x.fontWeight = "bold";
x.fontSize = 11;
x.textAlign = "center";
x.color = 0x2B333C;
x = _global.styles.TodayStyle = new CSSStyleDeclaration();
x.color = 0xffffff;
x = _global.styles.HeaderDateText = new CSSStyleDeclaration();
x.fontSize = 12;
x.fontWeight = "bold";
x.textAlign = "center";
}
不过一般的你不能直接修改代码就能得到效果,你需要FLA 文件源代码:Flash MX 2004_install_dir/en/First Run/ComponentFLA/StandardComponents.fla 文件重新生成组件,另一个方法是
把代码加在时间轴上:
_global.style.color = 0xff0000;
_global.style.selectionColor=0xeeeeee;
_global.style.rollOverColor=0xffde00;
_global.styles.ScrollSelectList.backgroundColor=0xdedede;
_global.styles.ScrollSelectList.borderColor=0x000000;
_global.styles.ComboBox.borderStyle="none"
代码是参考类文件里的定义加的,来修改combobox组件的样式。
图片如下:
static function setThemeDefaults():Void
{
var o = _global.style;
o.themeColor = 0x80ff4d; // "haloGreen" base color
o.disabledColor = 0x848284;
//模式窗口的的背景透明度,如你用alert组件弹出模式窗口是的背景
//默认为全透明
o.modalTransparency = 0;
//是否填充
o.filled = true;
//是否使用画笔
o.stroked = true;
//画笔宽度
o.strokeWidth = 1;
//画笔颜色
o.strokeColor = 0x000000;
//添充颜色
o.fillColor = 0xffffff;
//循环时间
o.repeatInterval = 35; // fast.
//延时
o.repeatDelay = 500; // half second.
//默认字体
o.fontFamily = "_sans";
//字体大小
o.fontSize = 12;
//选择项的背景颜色,在list,combobox等组件中使用
o.selectionColor = 0xCDFFC1;
//移动到项上时的前景色
o.rollOverColor = 0xe3ffd6;
o.useRollOver = true;
o.backgroundDisabledColor = 0xdddddd;
o.selectionDisabledColor = 0xdddddd;
//选择动画的持续时间
o.selectionDuration = 200;
//打开延时
o.openDuration = 250;
//默认边框样式,重要!方便的修改掉难看的边框
//边框样式有"insert","none","solid","alert"等
o.borderStyle = "inset";
//默认字体颜色
o.color = 0xB333C;
//字体选择颜色
o.textSelectedColor = 0x005f33;
//字体over颜色
o.textRollOverColor = 0x2b333c;
//字体无效颜色,其实是组件无效时,里面的字体颜色
o.textDisabledColor = 0xffffff;
//datagrid组件是否有垂直分割线
o.vGridLines = true;
//datagrid组件是否有水平分割线
o.hGridLines = false;
//分割线的颜色
o.vGridLineColor = 0x666666;
o.hGridLineColor = 0x666666;
o.headerColor = 0xeaeaea;
o.indentation = 17;
//tree组件里用的默认图标
o.folderOpenIcon = "TreeFolderOpen";
o.folderClosedIcon = "TreeFolderClosed";
o.defaultLeafIcon = "TreeNodeIcon";
o.disclosureOpenIcon = "TreeDisclosureOpen";
o.disclosureClosedIcon = "TreeDisclosureClosed";
o.popupDuration = 150;
//日历组件当天的颜色
o.todayColor = 0x666666;
// default styles for various classes. other
// properties are set on the ListAssets symbol
//列表项的背景颜色
o = _global.styles.ScrollSelectList = new CSSStyleDeclaration();
o.backgroundColor = 0xffffff;
////列表项的边框颜色
o.borderColor = 0xcacaca;
//边框样式
o.borderStyle = "inset";
//下面是各个组件的具体参数默认定义,自己研究啊
o = _global.styles.ComboBox = new CSSStyleDeclaration();
o.borderStyle = "inset";
o = _global.styles.NumericStepper = new CSSStyleDeclaration();
o.textAlign = "center";
o = _global.styles.RectBorder = new CSSStyleDeclaration();
o.borderColor = 0xd5dddd;
o.buttonColor = 0x6f7777;
o.shadowColor = 0xEEEEEE;
o.highlightColor = 0xc4cccc;
o.shadowCapColor = 0xd5dddd;
o.borderCapColor = 0x919999;
var p = new Object();
p.borderColor = 0xFF0000;
p.buttonColor = 0xFF0000;
p.shadowColor = 0xFF0000;
p.highlightColor = 0xFF0000;
p.shadowCapColor = 0xFF0000;
p.borderCapColor = 0xFF0000;
mx.core.UIComponent.prototype.origBorderStyles = p;
var x;
x = _global.styles.TextInput = new CSSStyleDeclaration();
x.backgroundColor = 0xffffff;
x.borderStyle = "inset";
_global.styles.TextArea = _global.styles.TextInput;
x = _global.styles.Window = new CSSStyleDeclaration();
x.borderStyle = "default";
//styleSheet declared on first frame of WindowAssets
x = _global.styles.windowStyles = new CSSStyleDeclaration();
x.fontWeight = "bold";
//styleSheet declared on first frame of DataGridAssets
x = _global.styles.dataGridStyles = new CSSStyleDeclaration();
x.fontWeight = "bold";
x = _global.styles.Alert = new CSSStyleDeclaration();
x.borderStyle = "alert";
x = _global.styles.ScrollView = new CSSStyleDeclaration();
x.borderStyle = "inset";
x = _global.styles.View = new CSSStyleDeclaration();
x.borderStyle = "none";
x = _global.styles.ProgressBar = new CSSStyleDeclaration();
x.color = 0xAAB3B3;
x.fontWeight = "bold";
x = _global.styles.AccordionHeader = new CSSStyleDeclaration();
x.fontWeight = "bold";
x.fontSize = "11";
x = _global.styles.Accordion = new CSSStyleDeclaration();
x.borderStyle = "solid";
x.backgroundColor = 0xFFFFFF;
x.borderColor = 0x8a938a;
x.headerHeight = 22;
x.marginLeft = x.marginRight = x.marginTop = x.marginBottom = -1;
x.verticalGap = -1;
x = _global.styles.DateChooser = new CSSStyleDeclaration();
x.borderColor = 0x919999;
x.headerColor = 0xffffff;
x = _global.styles.CalendarLayout = new CSSStyleDeclaration();
x.fontSize = 10;
x.textAlign = "right";
x.color = 0x2B333C;
x = _global.styles.WeekDayStyle = new CSSStyleDeclaration();
x.fontWeight = "bold";
x.fontSize = 11;
x.textAlign = "center";
x.color = 0x2B333C;
x = _global.styles.TodayStyle = new CSSStyleDeclaration();
x.color = 0xffffff;
x = _global.styles.HeaderDateText = new CSSStyleDeclaration();
x.fontSize = 12;
x.fontWeight = "bold";
x.textAlign = "center";
}
不过一般的你不能直接修改代码就能得到效果,你需要FLA 文件源代码:Flash MX 2004_install_dir/en/First Run/ComponentFLA/StandardComponents.fla 文件重新生成组件,另一个方法是
把代码加在时间轴上:
_global.style.color = 0xff0000;
_global.style.selectionColor=0xeeeeee;
_global.style.rollOverColor=0xffde00;
_global.styles.ScrollSelectList.backgroundColor=0xdedede;
_global.styles.ScrollSelectList.borderColor=0x000000;
_global.styles.ComboBox.borderStyle="none"
代码是参考类文件里的定义加的,来修改combobox组件的样式。
图片如下:
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}