I'm doing some programmatic validation of some field values in a form, is there any way in Actionscript to highlight the field in red the way the validators do?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
you just need to set errorString property on programmatic validation error
<s:TextInput errorString="error string value" />
<mx:TextInput errorString="error string value" />
回答2:
Using:
var textField:TextField = new TextField();
addChild(textField);
To highlight the background in AS3:
textField.background = true;
textField.backgroundColor = 0xFFF000;
To highlight the border in AS3:
textField.border = true;
textField.borderColor = 0xFFF000;
To turn it off, just set the appropriate boolean to false
.
回答3:
Try using glow filter:
<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;"/>