# Horizontal Scrollbar

**URL:** https://forum.kirupa.com/t/horizontal-scrollbar/287127
**Category:** flash
**Created:** [April 26, 2009, 11:41pm UTC](https://forum.kirupa.com/t/horizontal-scrollbar/287127 "2009-04-26T23:41:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![goalpost95](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@goalpost95](https://forum.kirupa.com/u/goalpost95)
#### Post date: [April 26, 2009, 11:41pm UTC](https://forum.kirupa.com/t/horizontal-scrollbar/287127/1 "2009-04-26T23:41:10Z")

</div>

I’m a noob when it comes to coding and I was wondering how I would convert this vertical scrollbar into a horizontal scrollbar

heres the code:

onClipEvent (load) {  
diff\_y = bound\_box.\_height-scroller.\_height;  
bounds = bound\_box.getBounds(this);  
top = bounds.yMin+(scroller.\_height/2);  
bottom = bounds.yMax-(scroller.\_height/2);  
function updateScrollbar () {  
content.\_y = -(((scroller.\_y-top)/diff\_y)\*(content.\_height-bound\_box.\_height));  
}  
friction = 0.90;  
}

onClipEvent (mouseDown) {  
if (scroller.hitTest(\_root.\_xmouse, \_root.\_ymouse)) {  
startDrag (“scroller”, false, scroller.\_x, top, scroller.\_x, bottom);  
scrolling = true;  
}  
}

onClipEvent (mouseUp) {  
stopDrag ();  
scrolling = false;  
}

onClipEvent (enterFrame) {  
if (scrolling) {  
updateScrollbar();  
newY = scroller.\_y;  
yspeed = (newY-oldY)\*0.50;  
oldY = newY;  
done = false;  
} else if (!done) {

oldypos = scroller.\_y;  
newypos = oldypos+yspeed;  
if (yspeed\<-0.2 || yspeed\>0.2) {  
yspeed \*= friction;  
} else {  
yspeed = 0;  
done = true;  
}

if (newypos\<top) {  
yspeed = -1_yspeed_friction;  
newypos = top;  
}  
if (newypos\>bottom) {  
yspeed = -1_yspeed_friction;  
newypos = bottom;  
}

scroller.\_y = newypos;  
updateScrollbar();  
}  
}
