Moving a slider on Release

Hey guys, I have a slider_mc and a movieclip with a bunch of buttons inside it. What I’m trying to do is get the slider_mc to slide horizontally until it is at the same _x as the button that has been pressed.

I have this code on the MC that contains all the buttons:

onClipEvent (load) {
this.prototype.moveSlider = function (target) {
	this.onEnterFrame = function () {
		if (_root.slider_mc._x > target._x) {
			_root.slider_mc._x--;
		}
		if (_root.slider_mc._x < target_.x) {
			_root.slider_mc._x++;
		}
		else {
			break;
		}
	}
}
}

and this code on every button thats within that MC:


on (release) {
	_parent.moveSlider(this);
}

But when I preview it, nothing happens when I click on the buttons. But I get no errors either. What am I doing wrong?

Thanks :slight_smile:

  • Vex