Flex中如何通过labelPlacement属性设置RadioButton控件按钮标签位置的例子

By Minidxer | August 19, 2008

接下来的例子演示了Flex中如何通过labelPlacement属性,设置RadioButton控件按钮标签位置。

让我们先来看一下Demo可以右键View Source或点击这里察看源代码):


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application name="RadioButton_labelPlacement_test"
  3.         xmlns:mx="http://www.adobe.com/2006/mxml"
  4.         layout="vertical"
  5.         verticalAlign="middle"
  6.         backgroundColor="white">
  7.  
  8.     <mx:Script>
  9.         <![CDATA[
  10.             import mx.controls.ButtonLabelPlacement;
  11.  
  12.             private const arr:Array = [ButtonLabelPlacement.LEFT,
  13.                                         ButtonLabelPlacement.RIGHT,
  14.                                         ButtonLabelPlacement.TOP,
  15.                                         ButtonLabelPlacement.BOTTOM];
  16.         ]]>
  17.     </mx:Script>
  18.  
  19.     <mx:ApplicationControlBar dock="true">
  20.         <mx:Form styleName="plain">
  21.             <mx:FormItem label="labelPlacement:">
  22.                 <mx:ComboBox id="comboBox"
  23.                         dataProvider="{arr}"
  24.                         selectedIndex="1" />
  25.             </mx:FormItem>
  26.         </mx:Form>
  27.     </mx:ApplicationControlBar>
  28.  
  29.     <mx:RadioButton id="radioButton"
  30.             label="RadioButton"
  31.             labelPlacement="{comboBox.selectedItem}" />
  32.  
  33. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Flex | No Comments » | 87 views Tags: , ,

Search Posts