# Easing problem

**URL:** https://forum.kirupa.com/t/easing-problem/11131
**Category:** flash
**Created:** [January 12, 2003, 8:48pm UTC](https://forum.kirupa.com/t/easing-problem/11131 "2003-01-12T20:48:01Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![iceman](https://avatars.discourse-cdn.com/v4/letter/i/46a35a/32.png) [@iceman](https://forum.kirupa.com/u/iceman)
#### Post date: [January 12, 2003, 8:48pm UTC](https://forum.kirupa.com/t/easing-problem/11131/1 "2003-01-12T20:48:01Z")

</div>

Hey everyone,

I was wondering if anyone could help with this problem I’m having.  
Here is the code from this site for easing.  
onClipEvent (load) {  
\_x = 0;  
\_y = 0;  
speed = 5;  
}  
onClipEvent (mouseDown) {  
endX = \_root.\_xmouse;  
endY = \_root.\_ymouse;  
}  
onClipEvent (enterFrame) {  
\_x += (endX-\_x)/speed;  
\_y += (endY-\_y)/speed;  
}  
and here is mine I changed it a bit but I still don’t see why it doesn’t work?

onClipEvent (load) {  
originalX = \_x;  
originalY = \_y;  
speed = 5;  
}  
onClipEvent (mouseUp) {  
endX = \_root.\_xmouse;  
endY = \_root.\_ymouse;  
}  
onClipEvent (enterFrame) {  
originalX += (endX-originalX)/speed;  
originalY += (endY-originalY)/speed;  
}

if anyone could help me with this it would be great. Thanks A Lot

Kyle

---

<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: [January 12, 2003, 8:57pm UTC](https://forum.kirupa.com/t/easing-problem/11131/2 "2003-01-12T20:57:18Z")

</div>

originalX = \_x;  
originalY = \_y;

this is the problem! You have to assign the X and Y positions to the variables but right now you assign the variables to the X and Y positions!  
so it should be

\_x = originalX;  
\_y = originalY;

cheers!

---

<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: [January 12, 2003, 10:17pm UTC](https://forum.kirupa.com/t/easing-problem/11131/3 "2003-01-12T22:17:30Z")

</div>

It doesn’t work because what you wrote is NOT easing.

This line doesn’t make sense anymore:

```auto
originalX += (endX-originalX)/speed;

```

There’s no easing, because you’re not manipulating the coordinates of the clip! (\_x and \_y)

pom :crazy:

---

<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: [January 12, 2003, 10:55pm UTC](https://forum.kirupa.com/t/easing-problem/11131/4 "2003-01-12T22:55:24Z")

</div>

Thanks Pom, but I’m still unsure as to what the code should look like? Any help would be great.

Thanks again

Kyle

---

<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: [January 13, 2003, 12:18am UTC](https://forum.kirupa.com/t/easing-problem/11131/5 "2003-01-13T00:18:45Z")

</div>

I meant, if you don’t change \_x and \_y at some point, you won’t see much motion, right? And why don’t you use the first piece of code?

---

<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: [January 13, 2003, 1:42am UTC](https://forum.kirupa.com/t/easing-problem/11131/6 "2003-01-13T01:42:57Z")

</div>

yeah, this is the kinda thing where you cant change it like you did. unless you did:

```auto

onClipEvent(load) {
_y=0;
_x=0;
OriganalY=_y;
OriganalX=_x;
}

```

ok wait, i just tested it and that wont work either, so you just have to stick with the original code. that is the only way i have ever seen it and the way i have always wrote it. if pom says you cant **THEN LISTEN** he knows his ActionScript.

---

<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: [January 13, 2003, 11:11am UTC](https://forum.kirupa.com/t/easing-problem/11131/7 "2003-01-13T11:11:29Z")

</div>

> \*Originally posted by [mdipi.com](http://mdipi.com) \*  
> \*\*if pom says you cant **THEN LISTEN** he knows his ActionScript. \*\*  
> 😛 I’m not saying you can’t do it that way, I’m just saying that you’re not moving the darn clip :beam:

---

<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: [January 13, 2003, 1:04pm UTC](https://forum.kirupa.com/t/easing-problem/11131/8 "2003-01-13T13:04:04Z")

</div>

I would make it like this:

onClipEvent (load) {  
\_x = 0  
\_y = 0  
speed = 5;  
}  
onClipEvent (mouseUp) {  
endX = \_root.\_xmouse;  
endY = \_root.\_ymouse;  
}  
onClipEvent (enterFrame) {  
originalX += (endX-originalX)/speed;  
originalY += (endY-originalY)/speed;  
\_x = originalX;  
\_y = originalY;  
}

:cool:

---

<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: [January 13, 2003, 3:17pm UTC](https://forum.kirupa.com/t/easing-problem/11131/9 "2003-01-13T15:17:01Z")

</div>

Yep Syko, that’s more like it.  
But why create 2 variables? Waste of time, waste of memory… :ninja:

---

<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: [January 13, 2003, 6:05pm UTC](https://forum.kirupa.com/t/easing-problem/11131/10 "2003-01-13T18:05:39Z")

</div>

yeah! I think so too but he wanted 'em! 😛

---

<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: [January 13, 2003, 6:13pm UTC](https://forum.kirupa.com/t/easing-problem/11131/11 "2003-01-13T18:13:09Z")

</div>

Hey,

Thanks for the help, I guess my question now is why does the position of the movieclip have to start at 0,0, why not somewhere else? Cause this is what I was trying to do. I would have a button that was draggable and when you let go it would ease back to its initial position. I guess theres no way around it I have to have it start at 0,0. Thanks again for everyones help.

Kyle

---

<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: [January 13, 2003, 6:46pm UTC](https://forum.kirupa.com/t/easing-problem/11131/12 "2003-01-13T18:46:01Z")

</div>

```auto
onClipEvent (load) {
  _x = 50;
  _y = 200;
  speed = 5;
}
onClipEvent (mouseDown) {
  endX = _root._xmouse;
  endY = _root._ymouse;
}
onClipEvent (enterFrame) {
  _x += (endX-_x)/speed;
  _y += (endY-_y)/speed;
}

```

---

<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: [January 13, 2003, 7:08pm UTC](https://forum.kirupa.com/t/easing-problem/11131/13 "2003-01-13T19:08:27Z")

</div>

> \*Originally posted by ilyaslamasse \*  
> \*\*

```auto
onClipEvent (load) {
  _x = 50;
  _y = 200;
  speed = 5;
}
onClipEvent (mouseDown) {
  endX = _root._xmouse;
  endY = _root._ymouse;
}
onClipEvent (enterFrame) {
  _x += (endX-_x)/speed;
  _y += (endY-_y)/speed;
}

```

\*\*

in other words it does not have to start at 0! 😛
