# Stoping/starting an MC's actionScript

**URL:** <https://forum.kirupa.com/t/stoping-starting-an-mcs-actionscript/176128>\
**Category:** Uncategorized\
**Created:** [January 20, 2006, 3:35pm UTC](https://forum.kirupa.com/t/stoping-starting-an-mcs-actionscript/176128 "2006-01-20T15:35:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![llyfre](https://avatars.discourse-cdn.com/v4/letter/l/8c91f0/32.png) [@llyfre](https://forum.kirupa.com/u/llyfre)\
**Post date:** [January 20, 2006, 3:35pm UTC](https://forum.kirupa.com/t/stoping-starting-an-mcs-actionscript/176128/1 "2006-01-20T15:35:37Z")

</div>

Hello,

I have a nested MC that functions as a continuous slider; when you mouse right of center it slides one way and when you mouse left of center it slides the opposite direction. Right at center it stops. The problem I have is that I’m using this as a menu at the bottom of a .swf and there are other places to mouse on the page, which means that this menu is constantly in motion even when it’s not being used. I want it to stop when it isn’t being used, only because it’s an MC I can’t use the onMouseOut command to stop the clip. I tried making a button that targets the clip and stops it when you roll over the button but it doesn’t work. Not sure what I need to do but sure would appreciate any and all help.

Here’s the script I’m currently using:

```auto
onClipEvent (mouseMove) {
	xcenter = 467.5;
	speed = 1/25;
}
onClipEvent (enterFrame) {
	var distance = _root._xmouse-xcenter;
	_x -= (distance*speed);
}
onClipEvent (enterFrame) {
	var distance = _root._xmouse-xcenter;
	_x -= (distance*speed);
	if (_x>0) {
		_x = -935;
	}
	if (_x<-935) {
		_x = 0;
	}
}

```

-Thanks,

Llyfre
