1 Reply Latest reply on Jan 17, 2011 6:37 AM by BrianIreland

    Number validator: when click, red box wont disappear when valid (but will with tab!)




      Reproduce problem:


      - paste code to new project (below)
      - click checkbox
      - click on the first input box
      - enter: 100


      The red glowing error box should have disappeared, but it will disappear only when you focus

      on another component e.g. the second input box.


      If you refersh the screen, click the checkbox, and **TAB** onto the first input box, type 100,

      the error glow will disappear as I expected. This is what I want for click also. Any ideas?


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"

                  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{

                  private function checkClick():void{
      <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"/>