# Help stopping the action

**URL:** https://forum.kirupa.com/t/help-stopping-the-action/58827
**Category:** Uncategorized
**Created:** [July 26, 2004, 3:08pm UTC](https://forum.kirupa.com/t/help-stopping-the-action/58827 "2004-07-26T15:08:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mad\_man](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mad\_man](https://forum.kirupa.com/u/mad_man)
#### Post date: [July 26, 2004, 3:08pm UTC](https://forum.kirupa.com/t/help-stopping-the-action/58827/1 "2004-07-26T15:08:47Z")

</div>

hello, i ok i am new to AS and i am making so where when u click on a square movieclip which has button in it a circle movieclip will come towards the the square you just clicked.

here is the code thats inside the square.

on(press){  
\_root.star1.endx = this.\_x;  
\_root.star1.endy = this.\_y;

\_root.star1.onEnterFrame = function(){  
speed = 3;  
x = this.endx - this.\_x;  
y = this.endy - this.\_y;  
yrate = y/x;  
xrate= 1;  
isBehind=false;  
if (this.endx \< this.\_x){  
yrate=-yrate;  
xrate=-xrate;  
isBehind=true;  
}  
this.\_x += xrate_speed;  
this.\_y += yrate_speed;  
}  
}

but problem i am having is stopping the circle. when it comes to the center of the square it just keeps moving in the middle. vibrating basicly. I tried putting if but that didnt work. nothing works and i need help plz.
