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

**URL:** <https://forum.kirupa.com/t/motion-prototype-funtion-please-i-really-need-this-thank-you/6335>\
**Category:** Uncategorized\
**Created:** [October 4, 2002, 1:56pm UTC](https://forum.kirupa.com/t/motion-prototype-funtion-please-i-really-need-this-thank-you/6335 "2002-10-04T13:56:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gerebeto](https://avatars.discourse-cdn.com/v4/letter/g/ce73a5/32.png) [@Gerebeto](https://forum.kirupa.com/u/Gerebeto)\
**Post date:** [October 4, 2002, 1:56pm UTC](https://forum.kirupa.com/t/motion-prototype-funtion-please-i-really-need-this-thank-you/6335/1 "2002-10-04T13:56:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2002, 4:25pm UTC](https://forum.kirupa.com/t/motion-prototype-funtion-please-i-really-need-this-thank-you/6335/2 "2002-10-04T16:25:09Z")

</div>

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

```

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2002, 4:36pm UTC](https://forum.kirupa.com/t/motion-prototype-funtion-please-i-really-need-this-thank-you/6335/3 "2002-10-04T16:36:22Z")

</div>

Hi,

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

Cheers,  
Miguel

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2002, 4:44pm UTC](https://forum.kirupa.com/t/motion-prototype-funtion-please-i-really-need-this-thank-you/6335/4 "2002-10-04T16:44:35Z")

</div>

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

```auto
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…

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2002, 5:01pm UTC](https://forum.kirupa.com/t/motion-prototype-funtion-please-i-really-need-this-thank-you/6335/5 "2002-10-04T17:01:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2002, 5:07pm UTC](https://forum.kirupa.com/t/motion-prototype-funtion-please-i-really-need-this-thank-you/6335/6 "2002-10-04T17:07:36Z")

</div>

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…

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

```

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2002, 9:54pm UTC](https://forum.kirupa.com/t/motion-prototype-funtion-please-i-really-need-this-thank-you/6335/7 "2002-10-04T21:54:58Z")

</div>

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