# Pan and zoom MovieClip

**URL:** <https://forum.kirupa.com/t/pan-and-zoom-movieclip/309518>\
**Category:** flash\
**Created:** [May 17, 2010, 2:43pm UTC](https://forum.kirupa.com/t/pan-and-zoom-movieclip/309518 "2010-05-17T14:43:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joepiooo](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@Joepiooo](https://forum.kirupa.com/u/Joepiooo)\
**Post date:** [May 17, 2010, 2:43pm UTC](https://forum.kirupa.com/t/pan-and-zoom-movieclip/309518/1 "2010-05-17T14:43:17Z")

</div>

Hello,

I’m made a map and I want to zoom in and out. The second thing I want is to make a bounding around my MovieClip.

```auto
function initDragger(zijde2:MovieClip):void
{
    zijde2.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    zijde2.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}

function mouseDownHandler(e:MouseEvent):void
{
    e.currentTarget.startDrag();
}
function mouseUpHandler(e:MouseEvent):void
{
    e.currentTarget.stopDrag();
}

initDragger(zijde2);

plus.addEventListener(MouseEvent.CLICK, onImageClick);

min.addEventListener(MouseEvent.CLICK, onImageClick2);

function onImageClick2(Event:MouseEvent):void
{
    if (zijde2.scaleX > .05) {
        zijde2.scaleX*=.5;
        zijde2.scaleY*=.5;
    }
}

function onImageClick(Event:MouseEvent):void
{
zijde2.scaleX*=2;
zijde2.scaleY*=2;
}

```

This is my code so far and I can zoom in and out but I can keep going and going. I want that he stops after 200% or something and when he is 100% you cant zoom out more. Also I want a bounding so I cant move the MovieClip outside his own stage height and width.

Is there someone that can help me with this because I’m really stuck at this point.

Thanks
