title: flash as3 zooming in (scaling up) to a specific point within a clip
body: <p>I'm trying to scale a container/parent movie clip up so that I effectively zoom in to a point referenced by one of its children. I've figured out how to use globalToLocal to get that point at the center of the stage, but the problem is the registration point for the container clip is (and needs to stay) at the upper left, so when I scale the container clip up, the point does not stay in the center of the screen. Here's my code:</p>
  
  <p>//REVISED:</p>
  
  <pre><code>var stageCenter = new Point(int(stage.stageWidth/2),int(stage.stageHeight)/2);
      var parPointLocal = parRef.globalToLocal(stageCenter);
      TweenMax.to(treeClip,.5,{x:parPointLocal.x,y:parPointLocal.y,onComplete:doZoom});
  
      function doZoom():void {
          var zoomPoint = zoomToMember(treeClip,stageCenter,2);
  
          function zoomToMember(target:MovieClip, center:Point, scale:Number):Point {
              var m:Matrix = new Matrix();
              m.translate(-center.x, -center.y);//move the center into (0,0)
              m.scale(scale, scale);//scale relatively to (0,0) (which is where our center is now)
              m.translate(center.x, center.y);//move the center back to its original position
              return m.transformPoint(new Point());//transform (0,0) using the whole transformation matrix to calculate the destination of the upper left corner
          }
  
          TweenMax.to (treeClip,.5,{x:zoomPoint.x,y:zoomPoint.y,scaleX:2,scaleY:2})
  
      }
  </code></pre>
  
  <p>When I do this, the zoomed point ends up being somewhere around "Mabel Greer's Toy Shop" - which I imagine was the center point of the stage before the treeClip was tweened so that "Jon Anderson" would be at the center of the stage.</p>
  
  <p><img src="https://i.stack.imgur.com/G86qS.gif" alt="screenshot"></p>