Flex, any way to programmatically highlight a fiel

2019-08-04 07:50发布

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?

3条回答
叼着烟拽天下
2楼-- · 2019-08-04 08:15

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;"/>
查看更多
老娘就宠你
3楼-- · 2019-08-04 08:21

you just need to set errorString property on programmatic validation error

<s:TextInput errorString="error string value" />
<mx:TextInput errorString="error string value" />
查看更多
啃猪蹄的小仙女
4楼-- · 2019-08-04 08:24

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.

查看更多
登录 后发表回答