Eric D wrote a very nice little prototype… i just added a little “bang” to the end of it…
/*extend to run function when completed movement
Bob Clagett added:
“functionsToRun” argument : a function name to be run
once the movie clip has reached it’s final location
*/
Movieclip.prototype.floatTo = function(speed, endx, endy, floataction) {
this.onEnterFrame = function() {
this.speed = “.”+speed;
this.endx = endx;
this.endy = endy;
this.dist_x = Math.round(endx-this._x);
this.dist_y = Math.round(endy-this._y);
this.vel_x = this.dist_x*this.speed;
this.vel_y = this.dist_y*this.speed;
this._x += this.vel_x;
this._y += this.vel_y;
//kill it if its not needed
if (this.vel_x == 0 and this.vel_y == 0) {
delete this.onEnterFrame;
if (floataction != null){
eval([floataction]())
}
}
};
};