# Ilyamasse question

**URL:** <https://forum.kirupa.com/t/ilyamasse-question/1044>\
**Category:** Uncategorized\
**Created:** [August 7, 2002, 2:28am UTC](https://forum.kirupa.com/t/ilyamasse-question/1044 "2002-08-07T02:28:25Z")\
**Posts on this page:** 5\
**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:** [August 7, 2002, 2:28am UTC](https://forum.kirupa.com/t/ilyamasse-question/1044/1 "2002-08-07T02:28:25Z")

</div>

In your scrolling window tutorial on this site I was wondering if you could explain to me what exactly this part of the code accomplishes?

MovieClip.prototype.move = function () {  
dest = \_root.xnew ;  
pos = this.\_x ;  
vel = (dest-pos)/7 ;  
this.\_x += vel ;  
}  
I understand technically the code but I don’t understand its purpose exactly. Like this line vel = (dest-pos)/7; why are you dividing by 7, how does it apply. I don’t see how this code apply’s if you could explain this to me it would be great. Thanks Alot

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:** [August 7, 2002, 3:14am UTC](https://forum.kirupa.com/t/ilyamasse-question/1044/2 "2002-08-07T03:14:18Z")

</div>

I am guessing vel stands for Velocity. Which is the speed it goes at. Dividing it by 7 makes it slow down as it reaches the end.

So its like this

Velocity = (destination-position)/7

Then the last part tells the \_x coordinate to be the number that Velocity equals.

I hope I am right!

---

<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:** [August 7, 2002, 4:53am UTC](https://forum.kirupa.com/t/ilyamasse-question/1044/3 "2002-08-07T04:53:15Z")

</div>

Oh yeah and…

dest = \_root.xnew ;  
pos = this.\_x ;

Dest means destination. That is why it is saved in the variable xnew

and Pos means position, which is where the object is currently.

---

<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:** [August 7, 2002, 6:01am UTC](https://forum.kirupa.com/t/ilyamasse-question/1044/4 "2002-08-07T06:01:22Z")

</div>

You’re right, lost. The thing is: I want the clip to go to a certain destination (dest) with a decreasing speed. So I get the distance between the clip and the destination, dest-pos, and I increase the position of the clip by a fraction of that distance.

Doing so, you see that on the next enterFrame, dest-pos will have decreased, so you’ll add less and so on and so on, until it reaches the destination.

And 7 is arbitrary. You’re free to change that value to see what it does (1 means direct jump and a big number means no motion).

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:** [August 7, 2002, 5:09pm UTC](https://forum.kirupa.com/t/ilyamasse-question/1044/5 "2002-08-07T17:09:37Z")

</div>

That makes perfect sense. I think I am getting the hang of this AS thing:)
