# Drag n snap + parent --\> child dragging

**URL:** <https://forum.kirupa.com/t/drag-n-snap-parent-child-dragging/234956>\
**Category:** flash\
**Created:** [August 7, 2007, 1:58pm UTC](https://forum.kirupa.com/t/drag-n-snap-parent-child-dragging/234956 "2007-08-07T13:58:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingscooty](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@kingscooty](https://forum.kirupa.com/u/kingscooty)\
**Post date:** [August 7, 2007, 1:58pm UTC](https://forum.kirupa.com/t/drag-n-snap-parent-child-dragging/234956/1 "2007-08-07T13:58:57Z")

</div>

Hey all!

I’m working on a lil project to learn a bit about dragging and snapping items on a stage. At the moment i can drag an item movieclip around and snap it to the base movieclip.

However, i can’t figure out how to drag the parent (base movieclip) which will also drag the item clip when it’s inside.

Here’s my code:

```auto

function fnUpdate()
{
    updateAfterEvent();
}

item.onPress = function()
{
    this.x = this._x;
    this.y = this._y;
    
    this.startDrag(true);
    this.onMouseMove = fnUpdate;
};

item.onRelease = meow.onReleaseOutside = function()
{
    this.stopDrag();
    delete this.onMouseMove;
    if(eval(this._droptarget) == base) {
        this._x = base._x;
        this._y = base._y;
    }else{
        this._x = this.x;
        this._y = this.y;
    }
};

base.onPress = function()
{
    this.startDrag();
};

base.onRelease = function()
{
    this.stopDrag();
};

```

Thanks again 🙂
