Skip navigation
Currently Being Moderated

onChange event

Jun 1, 2009 5:23 AM

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.

 
Replies
  • Currently Being Moderated
    Jun 10, 2009 3:30 AM   in reply to KrishnaKumar.B

    Try either of these options:

     

    //so you make your textField

    var textField:TextField = new TextField();

    //either use bindSetter to check on changes to the textfields text                 
    BindingUtils.bindSetter(onChangeValue(),textField,"text");

     

    //or add an eventlistener                 
    textField.addEventListener(Event.CHANGE,onChangeValue());

     

    I'm guessing that should work let me know

     

    good luck

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 11, 2009 4:46 PM   in reply to KrishnaKumar.B

    There are different event to handle textChange its change event. For tabs focusIn & focusOut events are there,

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 17, 2010 5:03 AM   in reply to KrishnaKumar.B

    I think the best answer here would be this:

     

         var tfield:TextField = new TextField();

         tfield.addEventListener(Event.CHANGE, tfieldChange);

         function tfieldChange (evt:Event):void{

              tfield.addEventListener(Event.focusOut, tfieldFocOut);

         }

         function tfieldFocOut (evt:Event):void{

              doWhatEver();

              tfield.removeEventListener(Event.focusOut, tfieldFocOut);

         }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points