Comment 0 for bug 1225529

Revision history for this message
Fabian Ebner (fox6x6x6) wrote :

package {
        import flash.display.Sprite;
        import flash.text.TextField;
        import flash.text.TextFieldAutoSize;
        import flash.events.MouseEvent;

        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.