Make the movie panning with moving mouse.
Example:ViewSource code:
stage.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoved) stage.addEventListener(Event.ENTER_FRAME,enterFrame) var newXPos = stage.stageWidth/2 -img_mc.width/2; var newYPos = stage.stageHeight/2 -img_mc.height/2; function mouseMoved(e){ var xPercent = mouseX / stage.stageWidth; newXPos = (stage.stageWidth - img_mc.width) * xPercent; var yPercent = mouseY / stage.stageHeight; newYPos = (stage.stageHeight - img_mc.height) * yPercent; }
function enterFrame(e: Event) { img_mc.x += (newXPos - img_mc.x)*0.15; img_mc.y += (newYPos - img_mc.y)*0.15; }
|
Code on the thumbnail map:
this.addEventListener(Event.ENTER_FRAME, onEF); var theImage:MovieClip = (this.parent as MovieClip).img_mc; var px:Number = 0; var py:Number = 0;
function onEF(e: Event) { px = theImage.x; py = theImage.y; thumb_mc.x = px*thumb_mc.width/theImage.width; thumb_mc.y = py*thumb_mc.height/theImage.height; thumb2_mc.x = thumb_mc.x; thumb2_mc.y = thumb_mc.y; } |
No comments:
Post a Comment