View Full Version : Motion Prototype Funtion. Please i really need this. Thank You.
Gerebeto
October 4th, 2002, 09:56 AM
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
pom
October 4th, 2002, 12:25 PM
MovieClip.prototype.easeTo(destx,desty,easing){
this._x+=(destx-this._x)/easing;
this._y+=(desty-this._y)/easing;
}pom :asian:
Gerebeto
October 4th, 2002, 12:36 PM
Hi,
thanks for your help but your function doesn't move it well...it moves the MC by steps...
Cheers,
Miguel
lostinbeta
October 4th, 2002, 12:44 PM
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.
Gerebeto
October 4th, 2002, 01:01 PM
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.
lostinbeta
October 4th, 2002, 01:07 PM
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:)
pom
October 4th, 2002, 05:54 PM
Ah, yes, sorry, I didn't test my code :+)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.