santhosha santhosha - 13 days ago 5
ActionScript Question

Zoom on Hover Adobe flash

Could someone help me how to achieve zoom in feature on mouse hover in adobe flash.

I am using Action script 3. I Imported an image to stage and converted to symbol then gave a instance name "ZoomTutorial'. I am stuck after that as i have no experience in action script.

Thanks in advance!

Answer

There is a similar question

In you're case you want to scale the object X and Y proportional. To do so you could attach two events on the object ( MovieClip I guess ) you want. The events should be

  1. "mouseOver"
  2. "mouseOut"

The script could be something like that:

var zoomAmount:Number = 0.5;
mc.addEventListener(MouseEvent.MOUSE_OVER, zoom);
mc.addEventListener(MouseEvent.MOUSE_OUT, zoomOut);

function zoom(event:MouseEvent):void {
    image1.scaleX += zoomAmount;
    image1.scaleY += zoomAmount;
}

function zoomOut(event:MouseEvent):void {
    image1.scaleX -= zoomAmount;
    image1.scaleY -= zoomAmount;
}