# Scrolling Navigation-scroll back to origin?

**URL:** https://forum.kirupa.com/t/scrolling-navigation-scroll-back-to-origin/273255
**Category:** flash
**Created:** [October 13, 2008, 6:19pm UTC](https://forum.kirupa.com/t/scrolling-navigation-scroll-back-to-origin/273255 "2008-10-13T18:19:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ScottG](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@ScottG](https://forum.kirupa.com/u/ScottG)
#### Post date: [October 13, 2008, 6:19pm UTC](https://forum.kirupa.com/t/scrolling-navigation-scroll-back-to-origin/273255/1 "2008-10-13T18:19:22Z")

</div>

I’ll paste the script that I have that controls a back and forth scrolling of the navigation bar.

Unfortunately, I didn’t write the code for this site and the guy who did is a more advanced Action Scripter, and he’s pretty much unreachable.

What I can’t seem to figure out is how to make it such that once the mouse goes out of the navigation area, I need it to scroll itself back to the origin.

Please help!

```auto
// Scroll Code
this.onEnterFrame = function() {
	scroll_speed = 10;
	if ((_root.mainMc.navMc._ymouse>=navMain._y) && (_root.mainMc.navMc._ymouse<=navMain._y+navMain._height)) {
		//trace("In the zone");
		if ((_root.mainMc.navMc._xmouse>=(hit_right._x-100)) && (navMain.hitTest(hit_right))) {
			navMain._x -= scroll_speed;
		} else if ((_root.mainMc.navMc._xmouse<=(hit_left._x+100)) && (navMain.hitTest(hit_left))) {
			navMain._x += scroll_speed;
		}
		// set the boundries
		if (navMain._x < -490) {navMain._x=-490;}
		if (navMain._x > -210) {navMain._x=-210;}
	} else {
		null;
		//trace("not in the zone");
		//delete this.onEnterFrame;
	}
};

```
