# Setting restrictions on mouse follow buttons

**URL:** <https://forum.kirupa.com/t/setting-restrictions-on-mouse-follow-buttons/11515>\
**Category:** Uncategorized\
**Created:** [January 18, 2003, 6:43am UTC](https://forum.kirupa.com/t/setting-restrictions-on-mouse-follow-buttons/11515 "2003-01-18T06:43:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arabonradar](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@Arabonradar](https://forum.kirupa.com/u/Arabonradar)\
**Post date:** [January 18, 2003, 6:43am UTC](https://forum.kirupa.com/t/setting-restrictions-on-mouse-follow-buttons/11515/1 "2003-01-18T06:43:05Z")

</div>

how can i make a MC follow the mouse, but only follow the mouse vertically, not horizontally? like stay wherever i stick it horizontally

---

<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:** [January 18, 2003, 8:33am UTC](https://forum.kirupa.com/t/setting-restrictions-on-mouse-follow-buttons/11515/2 "2003-01-18T08:33:42Z")

</div>

Are you using startDrag()?

You can do it with start drag like this (on a movie clip)…

```auto
onClipEvent (load) {
	this._x = 300;
	this._y = 150;
}
on (press) {
	startDrag(this, true, this._x, 100, this._x, 200);
}
on (release) {
	stopDrag();
}

```

You define the x and y in the onClipEvent(load)

Then in the on(press) you define a startDrag(clip, lockcenter, left, top, right, bottom)

This puts the clip at \_y 150, so you can drag the clip 50px up to 100 or 50 px down to 200.

The on(release) defined the stopDrag() so you can… well… stop dragging the clip.

If you were using anything other than that, you can just remove the \_x variables.

Without clicking and dragging it would look like this…

```auto
onClipEvent (load) {
	this._x = 300;
	this._y = 150;
}
onClipEvent (enterFrame) {
	startDrag(this, true, this._x, 100, this._x, 200);
}

```

For a more realistic approach try this…  
[http://www.kirupa.com/developer/mx/followease.asp](http://www.kirupa.com/developer/mx/followease.asp)

You can do that and just remove any line that says \_x or \_xmouse in it.

---

<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:** [January 19, 2003, 12:05am UTC](https://forum.kirupa.com/t/setting-restrictions-on-mouse-follow-buttons/11515/3 "2003-01-19T00:05:21Z")

</div>

okay the codes working good so far, but how would i make it so when i press the menu button that is following the mouse, that it stops dragging (and goes to frame 2 that shows the rest of the menu. ive attatched the file if it helps.

---

<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:** [January 19, 2003, 12:57am UTC](https://forum.kirupa.com/t/setting-restrictions-on-mouse-follow-buttons/11515/4 "2003-01-19T00:57:49Z")

</div>

Here’s a basic drag and drop menu. You can rip it apart and tailor it to your style if you like.  
[menu.fla](http://www.bluprint.com/dev/menu.fla)  
Hope it helps.
