Catch the current mouseX and mouseY values

This is a basic use of the mouse move event in order to get the current mouseX and mouseY values :

output

Alternative content

Get Adobe Flash player

package;
import flash.text.TextField;
import flash.Lib;
import flash.events.MouseEvent;

class Main
{
	static function main()
	{
			new Main();
	}
	public function new()
	{
			/*Create a new TextField*/
			var t = new TextField();
			t.text = "Let's try the MOUSE MOVE event.";
			t.width = 300;
			/*Make it unselectable*/
			t.selectable = false;
								
			/*Add it on the scene*/
			Lib.current.addChild(t);
								
			/*Add an event listener on the scene and display the mouseX and mouseY values*/
			Lib.current.addEventListener(MouseEvent.MOUSE_MOVE, function(e:MouseEvent)
			{
					t.text = "X :"+e.localX + "\nY :"+e.localY;
			});
								
	}
}	

Compile and test :

haxe -swf9 MouseMove.swf -main Main 

NOTE : We also can get the mouseX and mouseY values like this : Lib.current.mouseX and Lib.current.mouseY

(33 times)