Came across Voets awesome ease prototype and I was just playing around with it to see how it works and I notice something strange…
here is the prototype for reference:
MovieClip.prototype.ease = function(x,y){
this.onEnterFrame = function(){
this._x = x-(x-this._x)/1.1;
this._y = y-(y-this._y)/1.1;
if(this._x > x-1 && this._x < x+1 && this._y > y-1 && this._y < y+1){
this._x = x;
this._y = y;
delete this.onEnterFrame
//do other stuff here, this is the point at which the object reaches its target
}
}
}
Now… I have 1 movie clip on the stage with this code in it’s actions:
onClipEvent (load) {
this.ease(oneX,oneY);
}
oneX and oneY are defined on the main stage… the problem is when I place the movie clip anywhere towards the bottom right it just jumps to it’s place but if I place the movie clip anwhere else it does what it’s supposed to do and ease into place… :puzzle:
attached are two examples. Example 1 shows the movie clip that just jumps right into place because it’s placed on the lower right. Example 2 is placed towards the top and it works perfect.
So is my setup wrong or is it something to do with the prototype? I am a noob when it comes to this stuff. Help.