# Drag and drop everything inside the target?

**URL:** <https://forum.kirupa.com/t/drag-and-drop-everything-inside-the-target/302418>\
**Category:** flash\
**Created:** [December 30, 2009, 4:27am UTC](https://forum.kirupa.com/t/drag-and-drop-everything-inside-the-target/302418 "2009-12-30T04:27:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unchew](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unchew](https://forum.kirupa.com/u/unchew)\
**Post date:** [December 30, 2009, 4:27am UTC](https://forum.kirupa.com/t/drag-and-drop-everything-inside-the-target/302418/1 "2009-12-30T04:27:55Z")

</div>

Hi I’m migrating from as2 to as3 and have a problem. I have a movieclip called papel\_ilus which has loaded images inside with text and stuff. I found a Drag And Drop code that constrains the movement of the \_x axis and have targeted the papel\_ilus movieclip. However, when I click the images inside they are dragged separately from the whole movieclip I targeted and everything is a mess. Is there a way to drag the whole “pack” as one? Here is the code I’m using:

```auto
import flash.geom.Rectangle;
 
var leftY:int = 0;
var rightY:int = 0;
 
papel_ilus.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
papel_ilus.addEventListener(MouseEvent.MOUSE_UP, onUp);
 
function onDown(e:MouseEvent):void
{
    var constrainY:Rectangle = new Rectangle(e.target.x, e.target.x, rightY, 110);
    e.target.startDrag(false, constrainY);
}
 
function onUp(e:MouseEvent):void
{
    e.target.stopDrag();
}

```

Thank you very much in advance!
