16 Replies Latest reply on Nov 2, 2009 4:44 AM by Begineer In Flash

    center the image when click the movieclip

    Begineer In Flash

      Need a big help guys...

       


      i am new with flash, and i had swf which contains big image it will resize to best fit.

       


      when i double click the image the clicked position come to center of the stage.

       

      i achived little bit, it zooming but image not come to center position.

       


      i have attached the fla file in it please give me a solution for it

       


      and i have used this script to zoom on double click and bolded 2 lines are to position the image.

       


      ////////////////////////////////////////////////////////////////////////////////////////// /

       

      imagePanel.onRelease = function()
      {

       


          if(lastclick - (lastclick=getTimer()) + 500 > 0){
              var sf = Math.abs(imagePanel.loadTemp._xscale);
              if (sf < 100) {
              //trace("zoomIn");      
           var xss = imagePanel.loadTemp._xscale > 0 ? (1) : (-1);
          var yss = imagePanel.loadTemp._yscale > 0 ? (1) : (-1);
          var sf = Math.abs(imagePanel.loadTemp._xscale);
          sf = 100;
          imagePanel.loadTemp._xscale = sf * xss;
          imagePanel.loadTemp._yscale = sf * yss;
          imagePanel.refreshPane();
        imagePanel.loadTemp._x = - (_xmouse) -35;
          imagePanel.loadTemp._y = - (_ymouse) - 150;

                
          }
          else {
          //trace("zoomOut");
          var xss = imagePanel.loadTemp._xscale > 0 ? (1) : (-1);
          var yss = imagePanel.loadTemp._yscale > 0 ? (1) : (-1);
          var sf = Math.abs(imagePanel.loadTemp._xscale);
          sf = best_fit;
          imagePanel.loadTemp._xscale = sf * xss;
          imagePanel.loadTemp._yscale = sf * yss;
          imagePanel.refreshPane();
          }
      }
      }

       

      ////////////////////////////////////////////////////////////////////////////////////////// ///////////