您的位置:首页 > 其它

Flex中如何设置CheckBox标签(Label)与主题(theme )颜色的例子

2011-08-14 14:36 465 查看
Flex中如何设置CheckBox标签(Label)与主题(theme
)颜色的例子
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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐