# Drag & Drop problem

**URL:** https://forum.kirupa.com/t/drag-drop-problem/275381
**Category:** Uncategorized
**Created:** [November 13, 2008, 8:15am UTC](https://forum.kirupa.com/t/drag-drop-problem/275381 "2008-11-13T08:15:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![joenutzz](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@joenutzz](https://forum.kirupa.com/u/joenutzz)
#### Post date: [November 13, 2008, 8:15am UTC](https://forum.kirupa.com/t/drag-drop-problem/275381/1 "2008-11-13T08:15:36Z")

</div>

Hi Flash gurus!  
I’m just doing a simple drag and drop excercise for school that im having abit of a problem with:  
The dragging and dropping is fine except when all the tiles are in place, the last graphic that you dragged into place stays on there and i have no idea whats causing the problem.  
here is the code:

```auto
stop();

tapdrag.initDragTile = initDragTile;
tapdrag.onPress = pressDragTile;
tapdrag.onRelease = releaseDragTile;
tapdrag.initDragTile();
tapdrag.myDragTarget = taptarget;

nozdrag.initDragTile = initDragTile;
nozdrag.onPress = pressDragTile;
nozdrag.onRelease = releaseDragTile;
nozdrag.initDragTile();
nozdrag.myDragTarget = noztarget;

function initDragTile() {
    this.inplace = 0;
    this.startX = this._x;
    this.startY = this._y;
    this.snapToTarget = 1;
    this.gotoAndStop("out");
}

function pressDragTile() {
    if (this.inplace == 0) {
        this.startDrag();
        this.swapDepths(this.getNextHighestDepth())
    }
}

function releaseDragTile() {
    this.stopDrag();
    if (this.inplace == 0){
        if (eval(this._droptarget) == this.myDragTarget){
            this.inplace = 1;
            this.gotoAndStop("inplace");
            if (this.snapToTarget == 1) {
                this._x = this.myDragTarget._x;
                this._y = this.myDragTarget._y;
                testAllIn();
            }
        } else {
            this._x = this.startX;
            this._y = this.startY;
        }
    }
}

function testAllIn() {
    if ((tapdrag.inplace == 1) && (nozdrag.inplace == 1)) {
        gotoAndStop("kegwin")
    }
}
                                                

```

Thanks in advaced,

Joenutz
