我可能會服用瘋狂的藥丸,但有人實際上得到了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