5 Replies Latest reply on Feb 3, 2011 6:52 AM by kglad

    zoom and drag a movieclip i.e map

    dannyb89

      anyone know a decent tutorial that will show me how to zoom a movieclip with a slider bar and or buttons etc and then click and drag the image around. just like how google maps behaves??? havent even got a clue where to start...

       

      Cheers

        • 1. Re: zoom and drag a movieclip i.e map
          kglad Adobe Community Professional & MVP

          to drag and drop:

           

          yourmovieclip.onPress=function(){

          this.startDrag();

          }

          yourmovieclip.onRelease=yourmovieclip.onReleaseOutside=function(){

          this.stopDrag();

          }

           

          to restrain movement, check the parameters for startDrag().  that will appy to your slider that will control a movieclip's _xscale and _yscale.

          1 person found this helpful
          • 2. Re: zoom and drag a movieclip i.e map
            dannyb89 Level 1

            Guess i can do something similar on the actual mc to move it arount once i have zoomed in, like startdrag in all directions and then us the params to say when to stop draggin like when there is no more mc to pull onto the stage?

             

            Sent from my iPhone 4

            • 3. Re: zoom and drag a movieclip i.e map
              dannyb89 Level 1

              Hi again.

               

              managed to get my slider working, however how do i apply zoom features to it. so far i have managed to get it to zoom on press but i want it to zoom depending on haw much you drag the slider up the bar i guess.

               

              Cheers

              • 4. Re: zoom and drag a movieclip i.e map
                dannyb89 Level 1

                Sorry for the bombardment of posts but i have found and badly tried to customise this code and got the following results so far. A little help to make this work correctly would be great please

                 

                At the moment it zooms in upside down and then once zoomed in and you start dragging it acts real dodgy. HELP...http://ffspace.fastfloor.net/zoom.zip flv

                FLV attached if needed

                • 5. Re: zoom and drag a movieclip i.e map
                  kglad Adobe Community Professional & MVP

                  for a slider (eg, slider_mc with dragbar_mc) to control the zoom of a movieclip (eg, target_mc), you need to start a loop (where you scale target_mc) when you start dragging your slider and you should terminate the loop when you stop dragging.

                   

                   

                  slider_mc.dragbar_mc.onPress=function(){

                  this.startDrag(false,this._x,0,this._x,this._parent._height-this._height,this._x);  // typical verical slide constraints when top-left reg points used

                  this.onEnterFrame=scaleF;

                  }

                  slider_mc.dragbar_mc.onRelease=...onReleaseOutside=function(){

                  delete this.onEnterFrame;

                  this.stopDrag();

                  }

                   

                  function scaleF(){

                  dragbar_mc._xscale=dragbar_mc._yscale=somefunctionOF(this._y);

                  }