接下来的例子演示了Flex Gumbo中如何通过自定义Skin和alpha属性,创建透明填充色TextArea。
2010-11-13 23:50
423 查看
接下来的例子演示了Flex Gumbo中如何通过自定义Skin和alpha属性,创建透明填充色TextArea。
下面是skins/CustomTextAreaSkin.mxml的代码:<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin name="CustomTextAreaSkin"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
minWidth="36" minHeight="36"
alpha.disabled="0.5">
<s:states>
<s:State name="normal"/>
<s:State name="disabled"/>
</s:states>
<fx:Metadata>
<![CDATA[
[HostComponent("spark.components.TextArea")]
]]>
</fx:Metadata>
<fx:Script>
/* Define the skin elements that should not be colorized.
For text area, the skin itself is colorized but the individual parts are not. */
static private const exclusions:Array = ["background", "scroller"];
override public function get colorizeExclusions():Array {return exclusions;}
/* Define the content fill items that should be colored by the "contentBackgroundColor" style. */
static private const contentFill:Array = ["bgFill"];
override public function get contentItems():Array {return contentFill};
</fx:Script>
<!-- border -->
<s:Rect left="0" right="0" top="0" bottom="0">
<s:stroke>
<s:SolidColorStroke color="0x686868" weight="1"/>
</s:stroke>
</s:Rect>
<!-- fill -->
<!--- Defines the appearance of the TextArea component's background. -->
<s:Rect id="background" left="1" right="1" top="1" bottom="1">
<s:fill>
<!--- Defines the background fill color. -->
<s:SolidColor id="bgFill" color="0xFFFFFF" alpha="0.5" />
</s:fill>
</s:Rect>
<!-- shadow -->
<s:Rect left="1" top="1" right="1" height="1">
<s:fill>
<s:SolidColor color="0x000000" alpha="0.12" />
</s:fill>
</s:Rect>
<!--- Defines the scroller used to scroll the RichEditableText. -->
<s:Scroller id="scroller" left="0" top="0" right="0" bottom="0">
<s:RichEditableText id="textView"
heightInLines="10"
paddingLeft="4" paddingTop="4"
paddingRight="4" paddingBottom="4"/>
</s:Scroller>
</s:SparkSkin>[/code]
下面是skins/CustomTextAreaSkin.mxml的代码:<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin name="CustomTextAreaSkin"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
minWidth="36" minHeight="36"
alpha.disabled="0.5">
<s:states>
<s:State name="normal"/>
<s:State name="disabled"/>
</s:states>
<fx:Metadata>
<![CDATA[
[HostComponent("spark.components.TextArea")]
]]>
</fx:Metadata>
<fx:Script>
/* Define the skin elements that should not be colorized.
For text area, the skin itself is colorized but the individual parts are not. */
static private const exclusions:Array = ["background", "scroller"];
override public function get colorizeExclusions():Array {return exclusions;}
/* Define the content fill items that should be colored by the "contentBackgroundColor" style. */
static private const contentFill:Array = ["bgFill"];
override public function get contentItems():Array {return contentFill};
</fx:Script>
<!-- border -->
<s:Rect left="0" right="0" top="0" bottom="0">
<s:stroke>
<s:SolidColorStroke color="0x686868" weight="1"/>
</s:stroke>
</s:Rect>
<!-- fill -->
<!--- Defines the appearance of the TextArea component's background. -->
<s:Rect id="background" left="1" right="1" top="1" bottom="1">
<s:fill>
<!--- Defines the background fill color. -->
<s:SolidColor id="bgFill" color="0xFFFFFF" alpha="0.5" />
</s:fill>
</s:Rect>
<!-- shadow -->
<s:Rect left="1" top="1" right="1" height="1">
<s:fill>
<s:SolidColor color="0x000000" alpha="0.12" />
</s:fill>
</s:Rect>
<!--- Defines the scroller used to scroll the RichEditableText. -->
<s:Scroller id="scroller" left="0" top="0" right="0" bottom="0">
<s:RichEditableText id="textView"
heightInLines="10"
paddingLeft="4" paddingTop="4"
paddingRight="4" paddingBottom="4"/>
</s:Scroller>
</s:SparkSkin>[/code]
相关文章推荐
- Flex Gumbo中如何利用itemRenderer属性自定义FxList内项目的例子
- Flex中如何通过设置toolTipField属性在ButtonBar控件中设定自定义tool tip的例子
- Flex中如何通过设置editable属性创建一个可编辑的DataGrid控件的例子
- Flex Gumbo中如何通过skinClass样式去掉Spark Panel下拉阴影的例子
- [置顶] 如何通过注解去读自定义的属性文件
- 如何通过javascript操作web控件的自定义属性
- Flex中如何通过variableRowHeight和wordWrap属性,创建行高度可变的Tree
- [ios]如何通过XIB 创建自定义的UIViewTableCell
- 如何给magento的产品分类创建一个自定义属性?
- Flex Gumbo 通过smooth属性设置BitmapGraphic对象平滑度的例子
- Flex中如何通过给ComboBox创建自定义的项提供源,使其下拉菜单显示复数项目。
- Flex Gumbo中如何通过textAlpha样式,设置TextGraphic透明度
- Flex中如何通过mode属性设置进度条ProgressBar动画状态的例子
- Flex的DateChooser控件中如何通过设置maxYear属性来设定允许的最大年限的例子
- Flex中如何通过给openItems属性设置一个XMLList或Array对象来打开Tree的一个节点的例子
- Flex中如何通过showAllDataTips属性使鼠标移动到图表时显示所有的数据Tips的例子
- Flex中如何利用iconFunction属性在ComboBox控件的下拉菜单中设定自定义图标的例子
- Flex中如何通过设置fontFamily样式在ComboBox控件中使用自定义嵌入字体的例子
- Flex中如何通过showCloseButton属性控制TitleWindow右上角关闭按钮有效/无效的例子
- Flex中如何设置进度条(ProgressBar)的自定义皮肤(Skin)的例子