[F8/AS2] Stopping a scrolling MC at a certain X

Hey guys, I have a little bit of a problem:

I have a sideways scrolling movieclip that is wider than the stage, but it won’t stop when it reaches the right edge of the stage itself.

Here’s the code:

_root.onEnterFrame = function() {
	zigScroll_mc._x += Math.cos((-_root._xmouse/Stage.width)*Math.PI)*15;
	if (zigScroll_mc._x>(-1*_parent._parent.data_mc._x)) {
		zigScroll_mc._x = (-1*_parent._parent.data_mc._x);
	}
	if (zigScroll_mc._x ==(-zigScroll_mc._width+(Stage.width-_parent._parent._x))) {
		zigScroll_mc._x = (-zigScroll_mc._width+(Stage.width-_parent._parent._x));
	}

I should mention that the part where you see _parent._parent is because the scrolling part is nested within 2 movieclips, and that data_mc is not at _x=0

can anyone give me a hand?

Thanks,
Andrew