# AS2-mc follows mouse-help

**URL:** <https://forum.kirupa.com/t/as2-mc-follows-mouse-help/231185>\
**Category:** flash\
**Created:** [July 2, 2007, 6:57pm UTC](https://forum.kirupa.com/t/as2-mc-follows-mouse-help/231185 "2007-07-02T18:57:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrizzle](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@chrizzle](https://forum.kirupa.com/u/chrizzle)\
**Post date:** [July 2, 2007, 6:57pm UTC](https://forum.kirupa.com/t/as2-mc-follows-mouse-help/231185/1 "2007-07-02T18:57:24Z")

</div>

Hi folks.

I have a movie clip with the following code attached:

```auto
onClipEvent (load) {
	_x = 0;
	_y = 0;
	speed = 5;
}
onClipEvent (enterFrame) {
	endX = _root._xmouse;
	endY = _root._ymouse;
	_x += (endX-_x)/speed;
	_y += (endY-_y)/speed;
}

```

The mc follows my mouse just fine, BUT!! The mc is inside my navigation menu mc. When i place that nav mc inside my main movie (site) the follow mc doesnt stay conatined within the nav mc, it jumps outside. The mc that follows my mouse stays about 200 px below my cursor. I assume this has something to do with the reference to “root” in the AS. How would i change that to keep the mouse follow mc inside the nav mc that it originates from ?

thanks
