Motion Prototype Funtion. Please i really need this. Thank You

Hello to Everybody,

i created a prototype function which fades in and fades out a MC.
i use it this way: MC.fade(“In”, speed, limit). It’s working Fine.

Now i want to create a prototype function which moves a MC including easing. I would like to be able to use it this way:

MC.move(goX, goY, speed); or something like this.

I have been trying for 2 days and i also looked in several places but i couldn’t find something like this. I am sure for a lot of people this is simple but i am having problems with it. Can someone help me?

Thank You,
Miguel

MovieClip.prototype.easeTo(destx,desty,easing){
   this._x+=(destx-this._x)/easing;
   this._y+=(desty-this._y)/easing;
}

pom :asian:

Hi,

thanks for your help but your function doesn’t move it well…it moves the MC by steps…

Cheers,
Miguel

That code works fine for me… well except that it should look like…

MovieClip.prototype.easeTo = function(destx, desty, easing) {
	this._x += (destx-this._x)/easing;
	this._y += (desty-this._y)/easing;
};

Wow, I never thought I would see the day when I could fix Ilyas’ coding! He is probably going to hate me now :evil:

Anyways, enough babbling, directly on the movie clip I applied these actions…

onClipEvent (enterFrame) {
	easeTo(0, 0, 5);
}

Well I did exactly that and it worked great. If it is jumpy for you, maybe you should up your fps rate, that could fix the problem.

Hi,

being this a prototype, shoudn’t i also be able to write this on the actions layer, to move the MC “InstanceName”?

_root.InstanceName.easeTo(0, 0, 5);

Thanks,
Miguel

P.S: about the error in the code i knew it was missing the “function” word. My problem is that i am not able to move the Mc with this command and i think i should be able to do that.

No, the _root.instanceName.easeTo on the main timeline won’t work.

It won’t work because the location needs to be updated onEnterFrame…so try this…

_root.instanceName.onEnterFrame = function(){
      this.easeTo(0,0,5);
}

<B>EDIT: </B> I just tested it, it works:)

Ah, yes, sorry, I didn’t test my code :+)