重现问题:
红色发光错误框应该已经消失,但是当你专注于另一个组件时它会消失,例如第二个输入框。
如果您在屏幕上显示,请单击复选框,然后在第一个输入框中输入 TAB ,键入100,错误发光将按预期消失。这也是我想点击的内容。有什么想法吗?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
initialize="onInit()">
<mx:Script>
<![CDATA[
import mx.validators.NumberValidator;
private var amountValidator:NumberValidator;
private function onInit():void{
amountValidator = new NumberValidator();
amountValidator.property = "text";
amountValidator.trigger = txtAmount;
amountValidator.triggerEvent = "change";
amountValidator.minValue = 10;
amountValidator.domain = "int";
amountValidator.precision = 0;
amountValidator.allowNegative = false;
amountValidator.source = txtAmount;
}
private function onInputChange():void{
amountValidator.validate();
trace("input");
}
private function checkClick():void{
if(myCheckBox.selected){
amountValidator.validate();
}
}
]]>
</mx:Script>
<mx:HBox horizontalGap="5" x="68" y="37">
<mx:CheckBox id="myCheckBox" click="checkClick()"/>
<mx:TextInput id="txtAmount" change="onInputChange()" width="160" height="20" restrict="0-9" maxChars="8" x="75" y="44"/>
<mx:TextInput id="dummyInput" y="72" x="75"/>
</mx:HBox>
</mx:Application>
答案 0 :(得分:1)
可爱的东西,终于找到了这个问题的答案。
Flex SDK 3.5下的logged as a bug有一个解决方法。将keyUp事件标记添加到目标TextInput组件,如下所示:
keyUp="txtAmount.drawFocus(true)"
宾果!