# onLoad vs. onClipEvent(load) -\> mystic error (atleast to me 8o) )

**URL:** <https://forum.kirupa.com/t/onload-vs-onclipevent-load-mystic-error-atleast-to-me-8o/147423>\
**Category:** Uncategorized\
**Created:** [May 10, 2005, 1:16pm UTC](https://forum.kirupa.com/t/onload-vs-onclipevent-load-mystic-error-atleast-to-me-8o/147423 "2005-05-10T13:16:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henxon](https://avatars.discourse-cdn.com/v4/letter/h/51bf81/32.png) [@Henxon](https://forum.kirupa.com/u/Henxon)\
**Post date:** [May 10, 2005, 1:16pm UTC](https://forum.kirupa.com/t/onload-vs-onclipevent-load-mystic-error-atleast-to-me-8o/147423/1 "2005-05-10T13:16:08Z")

</div>

Hello.

I have a movieclip with instance name _linkholder_, on the root of the movie. In this, I had this code so that the movieclip worked as a infinit menu:

```auto
onClipEvent(load) {
	var xcenter = _root.mask._x+_root.mask._width/2;
	var speed = 2/10;
	var begX = _root.mask._x;
}

onClipEvent(enterFrame) {
		var endX = _root.mask._x+(_root.mask._width - 150);
		//scroll starts from 0 at every gallery
		this._x = begX;
	}
	
	if (_root.mask.hitTest(_root._xmouse, _root._ymouse)) {
		var distance = _root._xmouse-xcenter;
		this._x -= (distance*speed);
		if (this._x>=begX) {
			this._x = begX;
		}
		if (this._x<=endX) {
			this._x = endX;
		}
	} else {
	}
}

```

This infinite menu worked, though I want the code outside the MC, so I put this code on a layer outside _linkholder:_

```auto
_root.linkholder.onLoad = function(){
	var xcenter = _root.mask._x+_root.mask._width/2;
	var speed = 2/10;
	var begX = _root.mask._x;
}

_root.linkholder.onEnterFrame = function(){
	var endX = _root.mask._x+(_root.mask._width - 150);
	//scroller starts from 0 at every gallery
	_root.linkholder._x = begX;

	if (_root.mask.hitTest(_root._xmouse, _root._ymouse)) {
		var distance = _root._xmouse-xcenter;
		_root.linkholder._x -= (distance*speed);
		if (_root.linkholder._x>=begX) {
			_root.linkholder._x = begX;
		}
		if (_root.linkholder._x<=endX) {
			_root.linkholder._x = endX;
		}
	} else {
 }
}

```

Then the infinite menu stoped scrolling. the onEnterFrame function still runs correctly (checked with a trace wich was printed all the time). I guessed that there was something wrong with using _this in the latter code, so I changed all this to \_root.linkholde_r, but that didn’t help neither. can u help me?

regards, henxon
