# Stop Move

**URL:** https://forum.kirupa.com/t/stop-move/8196
**Category:** flash
**Created:** [November 15, 2002, 3:34pm UTC](https://forum.kirupa.com/t/stop-move/8196 "2002-11-15T15:34:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![albert](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@albert](https://forum.kirupa.com/u/albert)
#### Post date: [November 15, 2002, 3:34pm UTC](https://forum.kirupa.com/t/stop-move/8196/1 "2002-11-15T15:34:05Z")

</div>

For move an MovieClip, we can use this code:  
onClipEvent (enterFrame) {  
\_x+=5;  
} , so i´w like stop de movieclip in a place (for example: in \_x=500)  
but, for example i put  
onClipEvent (enterFrame) {  
\_x+=5;  
if (\_x=500) {  
stop();  
}

} the moving is not good. I´m sorry for my explain, so i do´nt speak english

---

<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: [November 15, 2002, 3:50pm UTC](https://forum.kirupa.com/t/stop-move/8196/2 "2002-11-15T15:50:43Z")

</div>

## ók first! \*\* “=” assigns a value to a variable and “==” checks the value \*\* so if you want to check the position then you should use “==” e.g. if(\_x\*\*==\*\*50) {} and if you want to assign a value the you have to use “=” e.g. this.\_x **=** 50;

and first you should know the way the object is moving!  
to detect if its Xpos if more or less than 50  
in this case it should be more so use  
if(\_x\*\*\>=\*\*50) {  
stopaction  
}  
because the objects Xposition is increased by 5 every frame and it may not be exactly 50 at any time.  
and for the stop action do not use stop(). stop(); stops the timeline from playing. but use \_x = 50;  
so the last code should be:

```auto
if(_x>=50) {
// we check if the _x is more or equal to 50
_x = 50
//we make the xpos 50 so it'll stay at 50
}

```

I hope you got it
