1 Reply Latest reply on Oct 4, 2006 11:11 AM by jonnybennett

    Zoom Issue??

    brandon_haslip Level 1
      I am working on an interactive floorplan project which has a Zoom In button to get a closer look at the floorplans, it does everything I want it to do with the exception of one thing, it won't stop. The thing just keeps zooming and zooming to infiniti. I have attached the code i am using to create the zoom below.

      Can anybody help me alter the code so each time you hit the Zoom In button it just zooms a little bit. Any help would be greatly appreciated. Thanks.

      Code:
        • 1. Re: Zoom Issue??
          jonnybennett Level 1
          I've not checked this, but shouldn't it work if you simply add an if statement and something to increment... in this example it should stop once amounttoZoom=10...

          on (release) {
          var startx:Number = (_root.floorplanholder._x+_root.floorplanholder._width)/2;
          var starty:Number = (_root.floorplanholder._y+_root.floorplanholder._height)/2;
          amountToZoom=0;
          _root.onEnterFrame = function() {
          if(amountToZoom<10){
          amountToZoom++;
          var cur_x:Number = (_root.floorplanholder._x+_root.floorplanholder._width)/2;
          var cur_y:Number = (_root.floorplanholder._y+_root.floorplanholder._height)/2;
          _root.floorplanholder._xscale += 2;
          _root.floorplanholder._yscale += 2;
          _root.floorplanholder._x += (startx-cur_x)/5;
          _root.floorplanholder._y += (starty-cur_y)/5;}
          };
          }