Jul 06
在前面的Flex中如何通过focusRoundedCorners样式在TextInput控件获得焦点后控制矩形对角圆滑与否的例子中我们了解了TextInput控件边角圆滑的控制,接下来的例子则演示了Flex中如何利用cornerRadius样式,控制Panel容器边角圆滑程度.
让我们先来看一下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" backgroundColor="white">
- <mx:Script>
- <![CDATA[
- private function dataTipFormatFunc(item:Number):String {
- return "cornerRadius = " + item;
- }
- ]]>
- </mx:Script>
- <mx:HBox id="hBox">
- <mx:Panel title="Panel w/o ControlBar" cornerRadius="{slider.value}" width="160" height="100">
- <mx:Text text="Lorem ipsum..." />
- </mx:Panel>
- <mx:Panel title="Panel w/ ControlBar" cornerRadius="{slider.value}" width="160" height="100">
- <mx:Text text="Lorem ipsum..." />
- <mx:ControlBar>
- <mx:Label text="I'm a ControlBar" />
- </mx:ControlBar>
- </mx:Panel>
- </mx:HBox>
- <mx:Spacer height="10" />
- <mx:HSlider id="slider" width="{hBox.width}" minimum="0" maximum="25" liveDragging="true" snapInterval="1" tickInterval="1" dataTipFormatFunction="dataTipFormatFunc" />
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:minidxer
