# Stopping a Movie Clip that Moves from Actionscripting?

**URL:** <https://forum.kirupa.com/t/stopping-a-movie-clip-that-moves-from-actionscripting/35773>\
**Category:** flash\
**Created:** [November 17, 2003, 11:54pm UTC](https://forum.kirupa.com/t/stopping-a-movie-clip-that-moves-from-actionscripting/35773 "2003-11-17T23:54:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hds](https://avatars.discourse-cdn.com/v4/letter/h/bb73d2/32.png) [@hds](https://forum.kirupa.com/u/hds)\
**Post date:** [November 17, 2003, 11:54pm UTC](https://forum.kirupa.com/t/stopping-a-movie-clip-that-moves-from-actionscripting/35773/1 "2003-11-17T23:54:04Z")

</div>

Hey. I built a game similar to the old Atari 2600 game Freeway. The object is to get the chicken to cross the highway while avoid becoming roadkill. It works fine. I kept tweaking it. I set it up so that when you reach a certain score the cars move faster. Now, I want to set it up that when you reach a certain score the player earns a stop sign. The ultimate goal is by pressing “s” the cars (which are all movie clips) will stop until the chicken makes it across to the other side.

I used the following script on one the cars:

onClipEvent(enterFrame){  
// “s” will stop the car  
if (key.isDown(83)){  
\_root.manualcar.stop();  
} // “a” will play the car  
if (key.isDown(65)){  
\_root.manualcar.play();  
}  
}

This does work for me. However, the only reason it works is because the movie clip, manualcar, is manually animated by a motion tween inside the movie clip. You could preview the animation in the library window.

I created all of my cars to not manually animate from motion tweening. All you see in the library preview window is just the car. I have the cars animating with the following script:

onClipEvent(load){

```
function faster() {
	car3speed = car3speed + 5;
	_x = _x + car3speed;			
}																															

```

}

onClipEvent(enterFrame){

```
car3speed = 7;
score500 = _root.totalscore.text;

if (_x &lt; 0) {
	direction = "right";
} else if (_x &gt; 550) {
	direction = "start";
}

if (direction == "right"){
    _x = _x + car3speed;	
} else if (direction == "start") {
	_x = -20;
}

if (score500 &gt;= 500){
	faster();
}

```

}

I prefer this way because I could vary the speed of each car (i.e. car3speed = 7; car1speed = 2; car8speed = 10).

When I try the [COLOR=royalblue]if (key.isDown(83)){\_root.car3.stop();  
}[/COLOR] way it doesn’t work. But if I use \_x = anynumber; instead of \_root.car3.stop(); it will stop the car and place it in that spot.

[COLOR=red]I want it to stop in its current position, similar to the way it did for me at the top and be allowed to move the cars with actionscript and not tweening.[/COLOR]

Help? Let me know if you need more info.  
Thanks.
