Drag n snap + parent --> child dragging

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:


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 :slight_smile: