How can I keep the slow easing motion when the button hits the MC but get rid of the “ease out” motion… Just want the button to stay on the MC really…
Y
var buttons:Array = [button1, button2, button3, button4, button5, button6, button7, button8, button9];
var sections:Array = ["Interesting..", "Hmm...", "Ok, I see...", "That's not right is it?", "Ha! Ha!", "Nice", "Good choice", "Alright...", "See what you are trying to do...", "Great!"];
var speed:Number = .1;
showNames.text = "What will you choose?";
// <-----------------
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*;
buttons*.id = (i+1); // <- add this to store the number at the end of the dropZone mc's
// <-----------------
}
function dragButton():Void {
delete this.onEnterFrame;
this.startDrag();
}
function easeBack():Void {
this.stopDrag();
trace(this);
var dropZone:MovieClip = _root["dropZone"+this.id]; // <- add this to know which movie clip
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;
// <-----------------
}
};
}
}