Flex中如何通过indicatorSkin样式给FormItem设置一个自定义指示器的例子

By Minidxer | April 28, 2009

接下来的例子演示了Flex中如何通过indicatorSkin样式,给FormItem设置一个自定义指示器。

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


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

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="top"
  5.         backgroundColor="white">
  6.  
  7.     <mx:Style>
  8.         FormItem {
  9.             indicatorGap: 24;
  10.         }
  11.     </mx:Style>
  12.  
  13.     <mx:Form>
  14.         <mx:FormHeading label="Controls" />
  15.         <mx:FormItem label="Button:"
  16.                 required="true"
  17.                 indicatorSkin="@Embed('assets/Button.png')">
  18.             <mx:Label text="Lorem ipsum..." />
  19.         </mx:FormItem>
  20.         <mx:FormItem label="ButtonBar:"
  21.                 required="true"
  22.                 indicatorSkin="@Embed('assets/ButtonBar.png')">
  23.             <mx:Label text="Lorem ipsum..." />
  24.         </mx:FormItem>
  25.         <mx:FormItem label="CheckBox:"
  26.                 required="true"
  27.                 indicatorSkin="@Embed('assets/CheckBox.png')">
  28.             <mx:Label text="Lorem ipsum..." />
  29.         </mx:FormItem>
  30.         <mx:FormItem label="ColorPicker:"
  31.                 required="true"
  32.                 indicatorSkin="@Embed('assets/ColorPicker.png')">
  33.             <mx:Label text="Lorem ipsum..." />
  34.         </mx:FormItem>
  35.     </mx:Form>
  36.  
  37. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: FormItem | No Comments » | 762 views Tags: , ,

Search Posts