# \[MX\] Infinite Menu as a loaded swf

**URL:** <https://forum.kirupa.com/t/mx-infinite-menu-as-a-loaded-swf/66840>\
**Category:** flash\
**Created:** [October 9, 2004, 7:48pm UTC](https://forum.kirupa.com/t/mx-infinite-menu-as-a-loaded-swf/66840 "2004-10-09T19:48:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryall](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@Ryall](https://forum.kirupa.com/u/Ryall)\
**Post date:** [October 9, 2004, 7:48pm UTC](https://forum.kirupa.com/t/mx-infinite-menu-as-a-loaded-swf/66840/1 "2004-10-09T19:48:41Z")

</div>

Hey Im using the infinite menu code from the tut.

The AS in the tut works fine in a stand-alone swf, but if you load it into another swf it wont work properly cuz it uses values like \_ymouse\<18

Those absolute values are not correct once the swf is loaded into a different sized movie.

What would you guys say is the best way to convert the code so that it would work when loaded?

If thought of changing every value to a target such as \_root.MCinMAINmovie.CONTAINERmcFORinfiniteMENU.\_xmouse\>218  
but this seems rather tedious… and it makes it hard to build code for something that needs to be a loaded swf and test it say before you have you main swf built.

is there a better or easier way to do this?

Heres the code for the infinite menu

```auto
onClipEvent (load) {
	xcenter = _root._width/2;
	speed = 1/10;
}
onClipEvent (enterFrame) {
	if (_root._xmouse<33 | _root._xmouse>218 | _root._ymouse<18 | _root._ymouse>62) {
		speed = 0;
	} else {
		speed = 1/10;
	}
	var distance = _root._xmouse-xcenter;
	_x -= (distance*speed);
	if (_x>0) {
		_x = -893;
	}
	if (_x<-893) {
		_x = 0;
	}
}

```

Thanks guys
