title: How do I limit the area a movieclip can be dragged?
body: <p>I am making a interactive map in as3/flash cs6.
  At the moment, I've got it to zoom in and out, and be dragged around.</p>
  
  <p>But my question is, how to I limit the area the map can be dragged, so it you can't see the white space outside of it?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    import flash.events.MouseEvent;
  
      function initDragger(mc:MovieClip):void
      {
          mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
          mc.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
  
  
      }
  
      function mouseDownHandler(e:MouseEvent):void
      {
          e.currentTarget.startDrag();
  
      }
      function mouseUpHandler(e:MouseEvent):void
      {
          e.currentTarget.stopDrag();
  
      }
  
      // Set up drag
      initDragger(map);
  
      zoomIn.addEventListener(MouseEvent.CLICK, mapzoomin);
  
      function mapzoomin(event:MouseEvent):void
      {
          if (map.scaleX &lt; 10)
          {
              map.scaleX +=  1;
              map.scaleY +=  1;
          }
  
      }
  
      zoomOut.addEventListener(MouseEvent.CLICK, mapzoomout);
  
      function mapzoomout(event:MouseEvent):void
      {
          if (map.scaleX &gt; 1)
          {
              map.scaleX -=  1;
              map.scaleY -=  1;
          }
  
      }
  </code></pre>