Flashtip : Zoom in a clip to a specific point

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

Responses (Add Your Comment)

  1. 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

  2. have you downloaded my example? it should work.

 

Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">