小小菜鸟的web菜园子

web开发学习。好记性不如烂笔头。每天进步一点点!

导航

设置RadioButton控件的背景色.

RadioButton控件的opaqueBackground样式.
示例:


代码:

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/06/18/setting-an-opaque-background-on-a-radiobutton-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout
="vertical"
        verticalAlign
="middle"
        backgroundColor
="white">

    
<mx:ApplicationControlBar dock="true">
        
<mx:Form styleName="plain">
            
<mx:FormItem label="opaqueBackground:">
                
<mx:ColorPicker id="colorPicker" />
            
</mx:FormItem>
        
</mx:Form>
    
</mx:ApplicationControlBar>

    
<mx:RadioButton id="radioButton"
            label
="The quick brown fox jumped over the lazy dog"
            opaqueBackground
="{colorPicker.selectedColor}" />

</mx:Application>

也可以通过AS设置:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/06/18/setting-an-opaque-background-on-a-radiobutton-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout
="vertical"
        verticalAlign
="middle"
        backgroundColor
="white">

    
<mx:Script>
        
<![CDATA[
            import mx.events.ColorPickerEvent;

            private function colorPicker_change(evt:ColorPickerEvent):void {
                radioButton.opaqueBackground = evt.color;
            }
        
]]>
    
</mx:Script>

    
<mx:ApplicationControlBar dock="true">
        
<mx:Form styleName="plain">
            
<mx:FormItem label="opaqueBackground:">
                
<mx:ColorPicker id="colorPicker"
                        change
="colorPicker_change(event);" />
            
</mx:FormItem>
        
</mx:Form>
    
</mx:ApplicationControlBar>

    
<mx:RadioButton id="radioButton"
            label
="The quick brown fox jumped over the lazy dog" />

</mx:Application>

posted on 2008-07-04 16:52  『小小菜鸟』  阅读(4310)  评论(0编辑  收藏  举报