设置RadioButton控件的背景色.

你。 提交于 2020-02-05 06:16:27
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>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!