Drag and hittest a movieclip to multiple movieclips
Hi!
I'm trying to find out a way to solve a problem with a drag and hittest exercise in AS2. What I want to do is the following: I have a movieclip (a ball) which I can drag to 9 possible movieclips (squares), so that ball has to hit only nine times with the different squares. And after the ball hits with a square, I want to make it available to hit with the rest of the squares and once a square is hitten it must be disabled.
I'm using thw following code to tha drag and hit test:
Code:
onClipEvent (load) {
hor = this._x;
ver = this._y;
this.onRollOver = function() {
this._alpha = 100;
};
this.onRollOut = function() {
this._alpha = 50;
};
this.onPress = function() {
this.getNextHighestDepth();
this._alpha = 100;
this.startDrag();
};
this.onRelease = function() {
this.stopDrag();
for (var i = 0; i<9; i++) {
if (this.hitTest(["sqaure"+i])) {
this.slideTo(["square"+i]._x,["square"+i]._y,0.5);
} else {
this.slideTo(hor,ver,0.5);
this._alpha = 50;
}
}
this.onReleaseOutside = function() {
this.stopDrag();
this.slideTo(hor,ver,0.5);
this._alpha = 85;
};
};
}
Can anyone help me pleaseee?