Click event
A basic use of the MouseEvent.CLICK event :
package;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.Lib;
class Main
{
static function main()
{
new Main();
}
public function new()
{
/*Create a new textField*/
var t = new TextField();
t.text = "Click here.";
/*Make it unselectable*/
t.selectable = false;
/*Add it on the scene*/
Lib.current.addChild(t);
/*Add an event listener on the textfield*/
t.addEventListener(MouseEvent.CLICK, function(e:MouseEvent)
{
t.text = "...you clicked";
});
}
}
Compile and test :
haxe -swf9 MouseClick.swf -main Main
Page(s) :
1

Contact
Follow me