Home | Contact Us | Store

Monitor Mouse Pointer Status with Flash ActionScript 3

This Flash ActionScript tutorial shows how to track the status of mouse pointer, for example, when the mouse pointer is over an object, when the mouse pointer leaves an object, etc...
Your flash player version is too old to see this video file!

Flash Tutorial Content:

Sometimes it also requires to know when the Mouse Pointer is over an object and when it leaves the object. The Flash ActionScript tutorial shows how to do it.

The complete Flash Movie is shown as above, you may try how it works before you start this tutorial.

Flash ActionScript Codes:

// Track mouse moving
function mouseMoving(evt:MouseEvent):void{

output_txt.text = "Mouse is in moving status";

}


stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoving);

 

// Check mouse click down
function mousePressDown(evt:MouseEvent):void{

output_txt.text = "Mouse is in pressed down status";

}


stage.addEventListener(MouseEvent.MOUSE_DOWN, mousePressDown);

 

// Check mouse release up after click down
function mouseReleaseUp(evt:MouseEvent):void{

output_txt.text = "Mouse is released up now";

}


stage.addEventListener(MouseEvent.MOUSE_UP, mouseReleaseUp);

 

// Check if mouse is over the Enter Button
function mouseOverBlueButton(evt:MouseEvent):void{

output2_txt.text = "...and Mouse is also over Button now";

}


blue_btn.addEventListener(MouseEvent.MOUSE_OVER, mouseOverBlueButton);

 

// Check if mouse leave the Enter Button
function mouseOutBlueButton(evt:MouseEvent):void{

output2_txt.text = "";

}


blue_btn.addEventListener(MouseEvent.MOUSE_OUT, mouseOutBlueButton);

Download Flash Source File:

Flash Source File mouse-2.fla

Remarks:

Many Flash Movies will use an interesting custom Mouse Pointer. This is very easy to do with Flash ActionScript 3. The next ActionScript tutorial will show you how to do it.

Mouse Control Flash ActionScript Tutorial