1 Reply Latest reply on Oct 22, 2009 12:17 PM by MeadowRyan

    zooming to mc and not to stage

    MeadowRyan Level 1

      Hello all, I had found a script which zooms to your mouse position, but is there a way to adapt this so it only zooms in on the particular mc and not the mouse position? thanks

       

      onClipEvent (mouseDown) {
          if (i>0) {
              return;
          }
          zoom = true;
          dir == 1 ? (dir=-1) : (dir=1);
          if (dir == 1) {
              pt = {x:_root._xmouse, y:_root._ymouse};
          }
      }
      onClipEvent (enterFrame) {
          if (!zoom) {
              return;
          }
          _root._xscale += dir*i*30/20;
          _root._yscale += dir*i*25/20;
          var pt2 = {x:pt.x, y:pt.y};
          _root.localToGlobal(pt2);
          _root._x -= (pt2.x-pt.x);
          _root._y -= (pt2.y-pt.y);
          i++;
          if (i == 12) {
              zoom = false;
              i = 0;
       
          }
      }


      onClipEvent(load)
      {
          var i = 0;  
      }

        • 1. Re: zooming to mc and not to stage
          MeadowRyan Level 1

          I've adapted the script to the following after doing som ready but now it doesn't zoom at all.  Basically what Im trying to do is only zoom in/out when you click on each individual movie clip and not based on the mouse location. Any help would be appreicated(In the following 'zoom_this' is the instance name of the mc Im trying to get this working for)

           

          thanks

           

           

           

          onClipEvent (mouseDown) {
              if (i>0) {
                  return;
              }
              zoom = true;
              dir == 1 ? (dir=-1) : (dir=1);
              if (dir == 1) {
                  pt = {x:_root.zoom_this._xmouse, y:_root.zoom_this._ymouse};
              }
          }
          onClipEvent (enterFrame) {
              if (!zoom) {
                  return;
              }
              _root.zoom_this._xscale += dir*i*30/20;
              _root.zoom_this._yscale += dir*i*25/20;
              var pt2 = {x:pt.x, y:pt.y};
              _root.zoom_this.localToGlobal(pt2);
              _root.zoom_this._x -= (pt2.x-pt.x);
              _root.zoom_this._y -= (pt2.y-pt.y);
              i++;
              if (i == 12) {
                  zoom = false;
                  i = 0;
           
              }
          }