Add change event to TextField : Event « TextField « Flash / Flex / ActionScript






Add change event to TextField

 
package {
  import flash.display.*;
  import flash.events.*;
  import flash.text.*;

  public class Main extends Sprite {
    private var inputfield:TextField = new TextField(  );

    public function Main() {
      inputfield.text = "";
      inputfield.width  = 150;
      inputfield.height = 30;
      inputfield.border     = true;
      inputfield.background = true;
      inputfield.type = TextFieldType.INPUT;
      addChild(inputfield);

      inputfield.addEventListener(Event.CHANGE, changeListener);
    }
    private function changeListener (e:Event):void {
      trace("event");
    }
  }
}

        








Related examples in the same category

1.Synchronizing two TextField objects