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