【发布时间】:2010-07-21 12:51:46
【问题描述】:
我在 Catalyst 中为 TextInput spark 控件制作了自定义皮肤。
问题在于,在 Flash Builder 的设计视图中,我无法使用应用的自定义外观调整 TextInput 控件的大小。我希望能够仅调整 TextInput 的长度,保持相同的字体度量和皮肤比例,因此我可以将相同的皮肤用于短、中和长 TextInput。
同样,在运行时,我想将控件停靠在父容器的右侧和/或底部,创建类似可调整大小的 Web 表单。
我为这个例子制作了一个丑陋但简单的 TextInput 皮肤:
<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fx="http://ns.adobe.com/mxml/2009">
<fx:Metadata>[HostComponent(spark.components.TextInput)]</fx:Metadata>
<s:states>
<s:State name="normal"/>
<s:State name="disabled"/>
</s:states>
<s:Group x="0" y="0">
<s:Rect height="31" radiusX="5" width="182" x="0.5" y="0.5">
<s:stroke>
<s:SolidColorStroke caps="none" color="#000000" joints="miter" miterLimit="4" weight="1"/>
</s:stroke>
<s:fill>
<s:SolidColor color="#FF90CD"/>
</s:fill>
</s:Rect>
<s:RichEditableText color="#2B4381" fontFamily="Arial" fontSize="12" tabStops="S0 S50 S100" x="11" y="11" width="161" heightInLines="1" id="textDisplay"/>
</s:Group>
</s:Skin>
我的第一个想法是使用9-slicing完成,但找不到任何示例。
提前致谢, 佩塔尔
【问题讨论】:
标签: apache-flex flash-builder flex4