Flex中如何利用indicatorGap样式设置一个Form表单空间间隔的例子
By Minidxer | November 14, 2008
接下来的例子演示了Flex中如何利用indicatorGap样式,设置一个Form表单空间间隔。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):
下面是完整代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white"
- creationComplete="init();">
- <mx:Style>
- FormItem {
- backgroundColor: haloSilver;
- }
- </mx:Style>
- <mx:Script>
- <![CDATA[
- import mx.events.SliderEvent;
- private var indicatorGapStyle:CSSStyleDeclaration;
- private function init():void {
- indicatorGapStyle = StyleManager.getStyleDeclaration("FormItem");
- }
- private function slider_change(evt:SliderEvent):void {
- indicatorGapStyle.setStyle("indicatorGap", evt.value);
- }
- ]]>
- </mx:Script>
- <mx:ApplicationControlBar dock="true">
- <mx:Label text="indicatorGap:" />
- <mx:HSlider id="slider"
- minimum="14"
- maximum="100"
- value="14"
- snapInterval="1"
- liveDragging="true"
- dataTipPlacement="bottom"
- dataTipPrecision="0"
- change="slider_change(event);" />
- </mx:ApplicationControlBar>
- <mx:Form>
- <mx:FormItem label="Lorem ipsum:">
- <mx:TextInput />
- </mx:FormItem>
- <mx:FormItem label="The quick brown fox jumped:" required="true">
- <mx:TextInput />
- </mx:FormItem>
- <mx:FormItem label="over the lazy dog:" required="true">
- <mx:Text text="The quick brown fox jumped over the lazy dog." />
- </mx:FormItem>
- </mx:Form>
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子
Topics:
Other |
No Comments » |
Tags: Form, FormItem, indicatorGap