# Moving a slider on Release

**URL:** https://forum.kirupa.com/t/moving-a-slider-on-release/158098
**Category:** flash
**Created:** [August 7, 2005, 12:40am UTC](https://forum.kirupa.com/t/moving-a-slider-on-release/158098 "2005-08-07T00:40:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Vexir](https://avatars.discourse-cdn.com/v4/letter/v/a183cd/32.png) [@Vexir](https://forum.kirupa.com/u/Vexir)
#### Post date: [August 7, 2005, 12:40am UTC](https://forum.kirupa.com/t/moving-a-slider-on-release/158098/1 "2005-08-07T00:40:18Z")

</div>

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:

```auto
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:

```auto

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 🙂

- Vex
