Return to Kroll Web Design home page Flash tutorials

« Return

ActionScript 3

MOUSE_OVER and MOUSE_OUT for movie clips and sprites

You can add event listeners to a movie clip, sprite, etc, to make it behave more like a button, so that you can change its look when mousing over it.

Download the FLA file

myShape_mc.addEventListener(MouseEvent.MOUSE_OVER, mouseover);
myShape_mc.addEventListener(MouseEvent.MOUSE_OUT, mouseout);

function mouseover(myEvent:MouseEvent)
{
	myShape_mc.scaleX = 1.1;
	myShape_mc.scaleY = 1.1;
	myShape_mc.blendMode = "overlay";
}

function mouseout(myEvent:MouseEvent)
{
	myShape_mc.scaleX = 1;
	myShape_mc.scaleY = 1;
	myShape_mc.blendMode = "normal";
}