Flex中如何设置CheckBox标签(Label)与主题(theme )颜色的例子
2011-08-14 14:36
465 查看
Flex中如何设置CheckBox标签(Label)与主题(theme
)颜色的例子
By Minidxer | June 28, 2009
接下来的例子演示了Flex中如何设置CheckBox标签(Label)与主题(theme )颜色。
<?xml
version="1.0"
encoding="utf-8"?>
<mx:Application name="CheckBox_color_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Style>
CheckBox {
fontWeight: bold;
iconColor: green;
}
.selectedStyle {
color: green;
textRollOverColor: green;
textSelectedColor: green;
themeColor: green;
}
.unselectedStyle {
color: red;
textRollOverColor: red;
textSelectedColor: red;
themeColor: red;
}
</mx:Style>
<mx:Script>
<![CDATA[
private function checkBox_change(evt:Event):void {
var tgt:CheckBox = evt.currentTarget as CheckBox;
if (tgt.selected) {
tgt.styleName = "selectedStyle";
} else {
tgt.styleName = "unselectedStyle";
}
}
]]>
</mx:Script>
<mx:CheckBox id="checkBox"
label="CheckBox"
selected="false"
styleName="unselectedStyle"
change="checkBox_change(event);" />
</mx:Application>
)颜色的例子
By Minidxer | June 28, 2009
接下来的例子演示了Flex中如何设置CheckBox标签(Label)与主题(theme )颜色。
让我们先来看一下Demo(可以点击这里察看源代码
):
<?xml
version="1.0"
encoding="utf-8"?>
<mx:Application name="CheckBox_color_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Style>
CheckBox {
fontWeight: bold;
iconColor: green;
}
.selectedStyle {
color: green;
textRollOverColor: green;
textSelectedColor: green;
themeColor: green;
}
.unselectedStyle {
color: red;
textRollOverColor: red;
textSelectedColor: red;
themeColor: red;
}
</mx:Style>
<mx:Script>
<![CDATA[
private function checkBox_change(evt:Event):void {
var tgt:CheckBox = evt.currentTarget as CheckBox;
if (tgt.selected) {
tgt.styleName = "selectedStyle";
} else {
tgt.styleName = "unselectedStyle";
}
}
]]>
</mx:Script>
<mx:CheckBox id="checkBox"
label="CheckBox"
selected="false"
styleName="unselectedStyle"
change="checkBox_change(event);" />
</mx:Application>
相关文章推荐
- Flex中如何设置CheckBox标签(Label)与主题(theme )颜色的例子
- Flex中如何设置CheckBox标签(Label)与主题(theme )颜色的例子
- Flex中通过设置labelPlacement属性设置RadioButton控件文本标签排列位置的例子
- Flex中如何通过itemRollOverColor和itemSelectionColor样式给列图ColumnChart设置选中/未选颜色的例子
- Flex中如何通过设置GridLines对象的horizontalAlternateFill样式交错显示LineSeries图表背景颜色的例子
- Flex中如何通过errorString属性在CheckBox控件上设置一个错误信息显示字符串的例子
- Flex中如何给depthColors样式设置一个颜色数组给树Tree控件不同层设置不同颜色的例子
- Flex中通过textAlign样式在一个按钮(Button)控件中设置标签(label)对齐方式的例子
- Flex中如何在Tree控件中指定一个自定义的label函数使其返回的标签名字为叶项目的名称的例子
- Flex中如何设置进度条(ProgressBar)边框颜色的例子
- Flex中如何通过borderColor样式设置DateField控件边框颜色的例子
- Flex中通过设置textAlign和labelStyleName样式设置FormItem容器中标签文本对齐方式的例子
- Flex中如何设置TextArea控件中的无效(disabled)文本颜色的例子
- Flex中如何通过selectionColor和selectionDisabledColor样式设置DataGrid的行选中与无效时颜色的例子
- Flex中如何利用width属性,将CheckBox的label标签截去。
- Flex的进度条(ProgressBar)控件中如何设置进度轨迹条和标签间竖直间隔间距的例子
- Flex中如何修改Alert控件中默认按钮标签(button label)的例子
- Flex中如何通过disabledColor样式设置NumericStepper控件无效时文本颜色的例子
- Flex中如何通过设置backgroundColor和backgroundAlpha改变DateChooser控件背景颜色的例子
- Flex中如何自定义CheckBox作为List数据提供源的例子| 中文Flex例子