Flex中如何设置CheckBox标签(Label)与主题(theme )颜色的例子
发布时间:2020-12-15 05:13:09 所属栏目:百科 来源:网络整理
导读:? ?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; i
?
<?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> <!-- styleName 为默认样式 selected为false是默认状态下未选中状态 change为触发事件--> <mx:CheckBox id="checkBox" label="CheckBox" selected="false" styleName="unselectedStyle" change="checkBox_change(event);" /> </mx:Application ? 文章来自: ?http://blog.minidx.com/2009/06/28/2656.html (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |