2013-09-14 22:03:10 |
Fabian Ebner |
description |
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. |
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(tf);
}
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. |
|