# Moving a ball (complex!)

**URL:** <https://forum.kirupa.com/t/moving-a-ball-complex/25868>\
**Category:** Uncategorized\
**Created:** [July 17, 2003, 5:39am UTC](https://forum.kirupa.com/t/moving-a-ball-complex/25868 "2003-07-17T05:39:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![javadi82](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@javadi82](https://forum.kirupa.com/u/javadi82)\
**Post date:** [July 17, 2003, 5:39am UTC](https://forum.kirupa.com/t/moving-a-ball-complex/25868/1 "2003-07-17T05:39:10Z")

</div>

There are two stationary balls-ball A and ball B. There is another ball- ball C, which has to move from ballA to ballB.

The problem is that when the I “run” the movie, ball C is automatically placed at the position of ballB. That is, I do not see ball C moving from the position of ball A to the position of ball B.

I have used a line-drawing algorithm to move ball C. Also, the entire stuff is written in Actionscript.

PS:this.\_x++ and this.\_y++ will not work because ballC has to travel the exact path between the two balls

---

<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:** [July 17, 2003, 5:59am UTC](https://forum.kirupa.com/t/moving-a-ball-complex/25868/2 "2003-07-17T05:59:39Z")

</div>

I only see 2 balls…whhere or wat color is the third one?

---

<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:** [July 17, 2003, 7:21am UTC](https://forum.kirupa.com/t/moving-a-ball-complex/25868/3 "2003-07-17T07:21:02Z")

</div>

ballA and ballB are of green color and the ballC is of red color.

you could look into the library.

Important:i want to see the ballC move from ballA to ballB.So I initially place ballC at ballA position and I wrote the actionscript to move ballC to ballB but when I run the script, I see ballC at ballB.

many thanks for opening the .fla

---

<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:** [July 17, 2003, 10:43am UTC](https://forum.kirupa.com/t/moving-a-ball-complex/25868/4 "2003-07-17T10:43:12Z")

</div>

onClipEvent(enterFrame){  
diffx=\_root.ball2.\_x-\_x  
diffy=\_root.ball2.\_y-\_y  
\_x+=diffx/5  
\_y+=diffy/5  
}

This will give it some easing also.

---

<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:** [July 17, 2003, 11:21am UTC](https://forum.kirupa.com/t/moving-a-ball-complex/25868/5 "2003-07-17T11:21:18Z")

</div>

kartik, i am not looking for easing. btw are you an indian?
