Flashtip : Zoom in a clip to a specific point
Januar 27th, 2009 • flash, math, snippet
Imagine you have to zoom in a mc on a specific point.
This math snippet works fine for me (I used TweenLite in my Code):
var tmpEndX : Number = ((spr.width)-(width*scaleFact))/2; var tmpEndY : Number = ((spr.height)-(spr.height*scaleFact))/2; var tmpXShift : Number = (mouseX-(width/2))*scaleFact; var tmpYShift : Number = (mouseY-(spr.height/2))*scaleFact; TweenMax.to(this, 0.5,{scaleX : scaleFact}); TweenMax.to(this, 0.5,{scaleY : scaleFact}); TweenMax.to(this, 0.5,{x : tmpEndX - tmpXShift}); TweenMax.to(this, 0.5,{y : tmpEndY - tmpYShift});
Demo and full Class here
I have been trying to adapt this code to zoom into a quarter of an mc that contains a circle graphic but I haven’t had any luck. Lso I tried messing around with your example but no matter what I do the movie always seems to publishes the same results