
Here we look at Mouse Scroll Zoom In and Zoom Out in AS3.
/** add Mouse Wheel event for stage **/
stage.addEventListener(MouseEvent.MOUSE_WHEEL, Zoom);
/** ma_mc is the mountain image MovieClip **/
function Zoom(e:MouseEvent):void
{
var mod:Number = 20;
ma_mc.scaleX += e.delta / mod;
ma_mc.scaleY += e.delta / mod;
ma_mc.x = ((2 * mouseX) - (2 * (e.localX * ma_mc.scaleX))) / 2;
ma_mc.y = ((2 * mouseY) - (2 * (e.localY * ma_mc.scaleY))) / 2;
}
...CHeeRS...

0 comments:
Post a Comment