0 Replies Latest reply on Oct 11, 2006 12:10 AM by allnighter

    onChange event in flex?

    allnighter
      I want to have an onChange event fire whenever a user changes the value in a textInput control and tabs or mouses out of it. This is a very simple thing to do in HTML but I can't seem to find the equivalent in ActionScript 3.

      1. Tried focusOut but that is fired everytime the focus goes away i.e. even if you go to a different browser window and then come back, this event will fire. Also it doesn't seem to work for a different reason too as I explain below.

      In my code, I do this -

      this.addEventListener(flash.events.FocusEvent.FOCUS_OUT,this.onChange);

      and my onChange method is as follows -

      public function onChange(evt:FocusEvent=null):void {
      //code
      }
      The problem is that when I tab out of the textInput control, I get an exception that Flex expected 1 parameter to the onChange handler and got zero. This is despite the fact that I have it defaulted to null. If I remove the argument alltogether, I get the opposite error i.e. Flex expected zero arguments but got 1.

      2. I tried the change event but that gets fired everytime a user types anything in the textInput. I want it to fire only when user tabs out or mouses out like in HTML

      3. I tried valueCommit event, it has the same problem as #2

      Could you please help me figure out how to implement a simple onChange in ActionScript? It is a ridiculously simple thing in HTML but does not seem to have a parallel in ActionScript/Flex.

      Thank you.