Hi I'm a relatively inexperienced actionscripter and wondered if anyone can help me understand why the code pastd below isn't working?
I'm trying to create a drag and drop activity and the idea is that my any of my draggable movieclips can be dropped on any of the drop movie clips. The problem is I can get any number of the draggable clicks to drop on one specific drop area. But when I insert a nested for loop which I had hoped would allow my drags to drop to any of the available drops it doesn't work. Here's a snippet of my code, I'll attach the whole thing at the bottom. Any help most welcome!
//STOP DRAG
for (var i = 0; i<numDrags; i++) {
this["drag"+i].onRelease = this["drag"+i].onReleaseOutside=function () {
this.stopDrag();
checkPosition();
};
}
//CHECK POSITION
function checkPosition() {
for (var i = 0; i<numDrags; i++) {
for (var j = 0; j<numDrags; j++) {
if (this["drag"+i].hitTest(this["drop"+j])) {
this["drag"+i]._x = this["drop"+j]._x;
this["drag"+i]._y = this["drop"+j]._y;
} else {
this["drag"+i]._x = this["drag"+i].origX;
this["drag"+i]._y = this["drag"+i].origY;
}
}
}
}