xxcainiao

设置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>

分类:

技术点:

相关文章:

  • 2021-11-26
  • 2021-04-14
  • 2022-02-10
  • 2022-12-23
  • 2021-10-16
  • 2022-03-04
  • 2021-12-13
  • 2021-05-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案