Flex,以编程方式突出显示验证器的红色字段的任何方式?

时间:2012-04-22 20:56:04

标签: flex actionscript flex4 flex3 adobe

我正在对表单中的某些字段值进行一些编程验证,在Actionscript中是否有任何方式以验证器的方式用红色突出显示该字段?

3 个答案:

答案 0 :(得分:5)

您只需要在程序验证错误

上设置errorString属性
<s:TextInput errorString="error string value" />
<mx:TextInput errorString="error string value" />

答案 1 :(得分:2)

使用:

var textField:TextField = new TextField();
addChild(textField);

突出显示AS3中的背景:

textField.background = true;
textField.backgroundColor = 0xFFF000;

突出显示AS3中的边框:

textField.border = true;
textField.borderColor = 0xFFF000;

要关闭它,只需将适当的布尔值设置为false

答案 2 :(得分:1)

尝试使用发光滤镜:

<fx:Declarations>
    <s:GlowFilter id="gf" color="#ff0000" alpha="1" blurX="5" blurY="5" />
</fx:Declarations>

<s:TextInput id="ti" width="80%"/>
<s:ToggleButton id="btn" label="glow on/off" click="ti.filters = btn.selected?new Array(gf) : null;"/>