我可能会服用疯狂的药丸,但有人实际上得到了errorSkin功能工作?我没有做任何疯狂的事情,只是扩展TextInput(spark)并设置errorSkin属性。SparkSkinInput验证错误的皮肤
我曾尝试使用SparkSkin创建皮肤,什么也没做。 我已经尝试使用ProgrammaticSkin创建皮肤,什么也没做。
TextInput始终是红色边框。我知道你可以设置errorColor和errorString,但我显然希望做的不仅仅是改变边框的颜色。我正在使用Flex 4.1进行编译。
任何想法?
执行力度:
<components:PromptedTextInput id="txt"
width="200"
horizontalCenter="0"
verticalCenter="0"
errorSkin="skins.TestSkin" />
类
public class PromptedTextInput extends TextInput
{
public function PromptedTextInput()
{
super();
}
}
错误皮肤:
<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Metadata>
<![CDATA[
[HostComponent("spark.components.TextInput")]
]]>
</fx:Metadata>
<s:states>
<s:State name="normal" />
<s:State name="disabled" />
<s:State name="error" />
</s:states>
<!-- fill -->
<s:Rect id="background"
left="1" right="1" top="1" bottom="1">
<s:fill>
<!--- Defines the background fill color. -->
<s:SolidColor id="bgFill"
color="#66CC66" />
</s:fill>
</s:Rect>
</s:SparkSkin>
另一个错误皮肤尝试:
public class TestSkin extends ProgrammaticSkin
{
public function TestSkin()
{
super();
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
graphics.clear();
graphics.beginFill(0x33CC33);
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
}
}
如果errorSkin是替换皮肤;你不需要更多的仅仅是一个彩色背景吗?尝试重新创建您的ErrorSkin作为TextInput外观的副本。 – JeffryHouser 2011-03-14 23:07:20