public class buttonClick extends Sprite { private var tf:TextField = new TextField();
public function buttonClick() { tf.text = "START"; tf.autoSize = TextFieldAutoSize.LEFT; tf.addEventListener(MouseEvent.CLICK, clickHandler); this.addChild(button);
}
private function clickHandler(e:MouseEvent):void { tf.text = "WHY";
}
}
}
When clicking on the TextField nothing happens (with Adobe Flash, the text changes to "WHY"). If you add the EventListener to the class itself, the click event gets registered.
package { Sprite; TextField; TextFieldAutoSi ze; MouseEvent;
import flash.display.
import flash.text.
import flash.text.
import flash.events.
public class buttonClick extends Sprite {
private var tf:TextField = new TextField();
}
}
}
}
When clicking on the TextField nothing happens (with Adobe Flash, the text changes to "WHY"). If you add the EventListener to the class itself, the click event gets registered.