# Zoom slider

**URL:** https://forum.kirupa.com/t/zoom-slider/311197
**Category:** Uncategorized
**Created:** [June 29, 2010, 10:30pm UTC](https://forum.kirupa.com/t/zoom-slider/311197 "2010-06-29T22:30:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rserge](https://avatars.discourse-cdn.com/v4/letter/r/dc4da7/32.png) [@rserge](https://forum.kirupa.com/u/rserge)
#### Post date: [June 29, 2010, 10:30pm UTC](https://forum.kirupa.com/t/zoom-slider/311197/1 "2010-06-29T22:30:50Z")

</div>

Hello,  
I am using the below AS for a slider. The code is for a vertical slider. I just want to turn it 90 degrees for a horizontal slider. I thought I just needed to switch \_y to \_x, and I changed range.height to width, but its not quite working. The button is not positioning itself on the scaling bar.Thanks…(see “starting position in code”. that is not working properly when I rotate it.) After rotating, the slider handle positions itself way beyond the minimum side of the scale bar.

onClipEvent(load){

```
scrollMin = _root.range._y-_root.range._height // minimum _y value possiible for scrollbar
scrollMax = _root.range._y // maximum _y value possiible for scrollbar

lowestScale = 50 // lowest desired scale of map in %
highestScale = 200 // highest desired scale of map in %

_y = scrollMin + (scrollMax - scrollMin)/2 // sets starting position of scrollbar (currently half-way)

scaleFactor = Math.pow(highestScale/lowestScale,1/(scrollMax-scrollMin)) // variable for SetScale
function SetScale(){
	// calculates scale and sets it
	_root.scale = _root.map._xscale = _root.map._yscale = lowestScale * Math.pow(scaleFactor,(scrollMax-_y))
}
SetScale()

```

}  
onClipEvent(mouseMove){  
if (dragging){  
\_y = Math.min(Math.max(\_parent.\_ymouse,scrollMin),scrollMax)  
SetScale()  
updateAfterEvent();  
}  
}
