Got this movie where users drag a MC (button1) to another one (dropTarget) and if it’s correct it eases into place (as used by lindquist in earlier threads). Got slight problem…I can get it to work on one of the dropTarget MC but not the other ones!
Any idea what I need to do? Attached fla.
Here’s the code:
var buttons:Array = [button1, button2, button3, button4, button5, button6, button7, button8, button9];
var sections:Array = ["1 a- correct!", "2 b - correct", "3 c - correct", "4 d - correct", ""];
var speed:Number = .1;
showNames.text = "Some text will go here";// <-----------------
for (i=0; i<buttons.length; i++) {
buttons*.startX = buttons*._x;
buttons*.startY = buttons*._y;
buttons*.onPress = dragButton;
buttons*.onRelease = buttons*.onReleaseOutside=easeBack;
buttons*.buttonName = sections*;// <-----------------
}
function dragButton():Void {
delete this.onEnterFrame;
this.startDrag();
}
function easeBack():Void {
this.stopDrag();
if (!dropZone.hitTest(this)) {
this.onEnterFrame = function() {
this._x += (this.startX-this._x)*speed;
this._y += (this.startY-this._y)*speed;
if(this._x<this.startX+1&&this._x>this.startX-1&&this._y<this.startY+1&&this._y>this.startY-1){
this._x = this.startX;
this._y = this.startY;
delete this.onEnterFrame;
}
};
}else{
this.onEnterFrame = function(){
this._x += (dropZone._x - this._x)*speed;
this._y += (dropZone._y - this._y)*speed;
if(this._x<dropZone._x+1&&this._x>dropZone._x-1&&this._y<dropZone._y+1&&this._y>dropZone._y-1){
this._x = dropZone._x;
this._y = dropZone._y;
delete this.onEnterFrame;
showNames.text = this.buttonName;// <-----------------
}
}
}
}
Appreciate any help!
Y