Flex中利用dropShadowEnabled样式创建一个具有阴影效果TextInput的例子
By Minidxer | August 17, 2008
接下来的例子演示了Flex中如何利用dropShadowEnabled样式,创建一个具有阴影效果的TextInput。
让我们先来看一下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">
- <mx:ApplicationControlBar dock="true">
- <mx:Grid>
- <mx:GridRow>
- <!-- dropShadowEnabled -->
- <mx:GridItem>
- <mx:CheckBox id="checkBox"
- label="dropShadowEnabled:"
- selected="true"
- labelPlacement="left" />
- </mx:GridItem>
- <!-- dropShadowColor -->
- <mx:GridItem>
- <mx:Label text="dropShadowColor:" />
- <mx:ColorPicker id="colorPicker" />
- </mx:GridItem>
- </mx:GridRow>
- <mx:GridRow>
- <!-- shadowDirection -->
- <mx:GridItem>
- <mx:Label text="shadowDirection:" />
- <mx:ComboBox id="comboBox" selectedIndex="1">
- <mx:dataProvider>
- <mx:String>left</mx:String>
- <mx:String>center</mx:String>
- <mx:String>right</mx:String>
- </mx:dataProvider>
- </mx:ComboBox>
- </mx:GridItem>
- <!-- shadowDistance -->
- <mx:GridItem>
- <mx:Label text="shadowDistance:" />
- <mx:HSlider id="slider"
- minimum="-10"
- maximum="10"
- value="2"
- liveDragging="true"
- snapInterval="1"
- tickInterval="1"
- dataTipPrecision="0" />
- </mx:GridItem>
- </mx:GridRow>
- </mx:Grid>
- </mx:ApplicationControlBar>
- <mx:TextInput id="textInput"
- dropShadowEnabled="{checkBox.selected}"
- dropShadowColor="{colorPicker.selectedColor}"
- shadowDirection="{comboBox.selectedItem}"
- shadowDistance="{slider.value}" />
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子
Topics:
Flex |
No Comments » |
Tags: dropShadowColor, dropShadowEnabled, shadowDirection, shadowDistance, TextInput