# Horizontal Volume Slider

**URL:** <https://forum.kirupa.com/t/horizontal-volume-slider/223576>\
**Category:** flash\
**Created:** [April 24, 2007, 1:13am UTC](https://forum.kirupa.com/t/horizontal-volume-slider/223576 "2007-04-24T01:13:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alemieux34](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@alemieux34](https://forum.kirupa.com/u/alemieux34)\
**Post date:** [April 24, 2007, 1:13am UTC](https://forum.kirupa.com/t/horizontal-volume-slider/223576/1 "2007-04-24T01:13:12Z")

</div>

I’ve got a simple vertical volume slider working, now I want to convert it to a horizontal one. The code on the button won’t change.

```auto
on (press) {
	startDrag ("", false, left, top, right, bottom);
	dragging = true;
}
on (release, releaseOutside) {
	stopDrag ();
	dragging = false;
} 

```

But this needs to change and I’ve tried swapping things around. The obvious things are that the \_x property needs to change. I’ve tried changing the direction with + instead of minus. I can get it to work, but the volume is loudest on the left side of the slider and lowest on the right side. I need to reverse that situation.

```auto
onClipEvent (load) {
    top = _y;
    left = _x;
    right = _x;
    bottom = _y+100;
}
onClipEvent (enterFrame) {
    if (dragging == true) {
        _root.s.setVolume(100-(_y-top));
    }
}

```

Any ideas?
