以下的例子将展示如何通过设置 opaqueBackground属性来设置Flex中的radioButton不透明的背景: '; } else { whichEl.style.display = 'none'; sb.innerHTML=' 显示代码'; whichEl.witdh="300px"; } } 隐藏代码 DE<<?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>DE< AS实现方式: DE<<?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>DE< 查看Demo演示 原创作者: peterd。翻译整理:一路风尘