Flex 4中如何给Panel设置bitmap填充背景色的例子
2010-11-14 00:20
811 查看
接下来的例子演示了Flex 4中如何通过BitmapFill和LinearGradient,给Panel设置bitmap填充背景色。 main.mxml:<?xml version="1.0" encoding="utf-8"?>
<s:Application name="Spark_Panel_fill_BitmapFill_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<mx:ApplicationControlBar width="100%" cornerRadius="0">
<mx:Form styleName="plain">
<mx:FormItem label="rotation:">
<s:HSlider id="rotationSlider"
minimum="-360"
maximum="360"
value="90"
liveDragging="true"
width="{pnl.width}" />
</mx:FormItem>
<mx:FormItem label="ratio:">
<s:HSlider id="ratioSlider"
minimum="0.0"
maximum="1.0"
value="0.2"
valueInterval="0.05"
liveDragging="true"
width="{pnl.width}" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<s:Panel id="pnl"
title="Spark Panel title"
width="320" height="240"
horizontalCenter="0" verticalCenter="0">
<s:Rect width="100%" height="100%">
<s:fill>
<s:BitmapFill source="@Embed('assets/pattern_140.gif')" />
</s:fill>
</s:Rect>
<s:Rect width="100%" height="100%">
<s:fill>
<s:LinearGradient rotation="{rotationSlider.value}">
<s:GradientEntry color="white"
alpha="0.0"
ratio="0.0" />
<s:GradientEntry color="#F0EBD2"
alpha="1.0"
ratio="{ratioSlider.value}" />
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:TextArea id="textArea"
verticalScrollPolicy="on"
left="20" right="20"
top="20" bottom="20">
<s:text>The quick brown fox jumps over the lazy dog.</s:text>
</s:TextArea>
</s:Panel>
</s:Application>[/code]
<s:Application name="Spark_Panel_fill_BitmapFill_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<mx:ApplicationControlBar width="100%" cornerRadius="0">
<mx:Form styleName="plain">
<mx:FormItem label="rotation:">
<s:HSlider id="rotationSlider"
minimum="-360"
maximum="360"
value="90"
liveDragging="true"
width="{pnl.width}" />
</mx:FormItem>
<mx:FormItem label="ratio:">
<s:HSlider id="ratioSlider"
minimum="0.0"
maximum="1.0"
value="0.2"
valueInterval="0.05"
liveDragging="true"
width="{pnl.width}" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<s:Panel id="pnl"
title="Spark Panel title"
width="320" height="240"
horizontalCenter="0" verticalCenter="0">
<s:Rect width="100%" height="100%">
<s:fill>
<s:BitmapFill source="@Embed('assets/pattern_140.gif')" />
</s:fill>
</s:Rect>
<s:Rect width="100%" height="100%">
<s:fill>
<s:LinearGradient rotation="{rotationSlider.value}">
<s:GradientEntry color="white"
alpha="0.0"
ratio="0.0" />
<s:GradientEntry color="#F0EBD2"
alpha="1.0"
ratio="{ratioSlider.value}" />
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:TextArea id="textArea"
verticalScrollPolicy="on"
left="20" right="20"
top="20" bottom="20">
<s:text>The quick brown fox jumps over the lazy dog.</s:text>
</s:TextArea>
</s:Panel>
</s:Application>[/code]
相关文章推荐
- 如何设置Flex中面板容器(Panel container)边框透明度的例子
- Flex 4中组件背景设置(填充方式)group为例子
- Flex中如何通过selectionColor和selectionDisabledColor样式设置DataGrid的行选中与无效时颜色的例子
- Flex中设置面板容器(Panel container)背景透明度的例子
- Flex中如何通过设置toolTipField属性在ButtonBar控件中设定自定义tool tip的例子
- Flex中如何通过borderColor样式设置DateField控件边框颜色的例子
- Flex中如何将DataGrid控件的菜单(Menu)设置为选择模式的例子
- Flex中如何通过dataTipOffset样式设置HSlider控件的数据开销的例子
- Flex中如何通过设置fontFamily样式在NumericStepper控件中使用嵌入字体的例子
- Flex中如何通过设置trackSkin为null将List控件中的滚动条轨道皮肤(track skin)去除的例子
- Flex中如何利用firstVisibleItem属性设置或取得第一个显示节点的例子
- Flex中通过设置fillColors样式改变ComboBox控件的填充背景颜色的例子
- Flex中如何设置CheckBox标签(Label)与主题(theme )颜色的例子
- Flex中如何通过getHeaderAt()函数以及selectedUpIcon,selectedOverIcon和selectedDownIcon样式给Accordion头部设置一个分割用图标的例子
- Flex中如何通过paddingTop样式设置TabNavigator控件内容与Tabs间距离的例子
- Flex中如何设置CheckBox标签(Label)与主题(theme )颜色的例子
- Flex中如何设置TextArea控件中的无效(disabled)文本颜色的例子
- Flex中如何通过设置cornerRadius样式设定NumericStepper控件边缘棱角圆滑幅度(corner radius)的例子
- Flex中如何利用dataDescriptor和labelFunction属性以及hasChildren()和getChildren()函数设置Tree中包含子节点个数的例子
- Flex中如何设置CheckBox标签(Label)与主题(theme )颜色的例子