# Please help me, newbie to Flash - horizontal scroll bar

**URL:** <https://forum.kirupa.com/t/please-help-me-newbie-to-flash-horizontal-scroll-bar/275228>\
**Category:** flash\
**Created:** [November 11, 2008, 1:40pm UTC](https://forum.kirupa.com/t/please-help-me-newbie-to-flash-horizontal-scroll-bar/275228 "2008-11-11T13:40:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bake](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bake](https://forum.kirupa.com/u/bake)\
**Post date:** [November 11, 2008, 1:40pm UTC](https://forum.kirupa.com/t/please-help-me-newbie-to-flash-horizontal-scroll-bar/275228/1 "2008-11-11T13:40:47Z")

</div>

Hi all,

I wondered if any of you would be kind enough to help me. I am creating a horizontal scrollbar for my website. The bar is to scroll through a selection of images. I initially created the vertical bar through Kirupas tutorial which was great but i want to create a horizontal one. I noticed on an earlier post someone came up with a simple code to creating one based on the Kirupa vertical tutorial but once i apply it to mine i get these 4 errors and i can simply cant figure out what is wrong. Can you help? I am a newbie to this so apologies in advance.

Here is the code:

scrolling = function () {  
var scrollWidth:Number = scrollTrack.\_width;  
var contentWidth:Number = contentMain.\_width;  
var scrollFaceWidth:Number = scrollFace.\_width;  
var maskWidth:Number = maskedView.\_width;  
var initPosition:Number = scrollFace.\_x=scrollTrack.\_x;  
var initContentPos:Number = contentMain.\_x;  
var finalContentPos:Number = maskWidth-contentWidth+initContentPos;  
var left:Number = scrollTrack.\_x;  
var top:Number = scrollTrack.\_y;  
var right:Number = scrollTrack.\_width-scrollFaceWidth+scrollTrack.\_x;  
var bottom:Number = scrollTrack.\_y;  
var dy:Number = 0;  
var speed:Number = 10;  
var moveVal:Number = (contentWidth-maskWidth)/(scrollWidth-scrollFaceWidth);  
scrollFace.onPress = function() {  
var currPos:Number = this.\_x;  
startDrag(this, false, left, top, right, bottom);  
this.onMouseMove = function() {  
dy = Math.abs(initPosition-this.\_x);  
contentMain.\_x = Math.round(dy\*-1\*moveVal+initContentPos);  
};  
};  
scrollFace.onMouseUp = function() {  
stopDrag();  
delete this.onMouseMove;  
};  
btnUp.onPress = function() {  
this.onEnterFrame = function() {  
if (contentMain.\_x+speed\<maskedView.\_x) {  
if (scrollFace.\_x\<=left) {  
scrollFace.\_x =left;  
} else {  
scrollFace.\_x -= speed/moveVal;  
}  
contentMain.\_x += speed;  
} else {  
scrollFace.\_x = left;  
contentMain.\_x = maskedView.\_x;  
delete this.onEnterFrame;  
}  
};  
};  
btnUp.onDragOut = function() {  
delete this.onEnterFrame;  
};  
btnUp.onRelease = function() {  
delete this.onEnterFrame;  
};  
btnDown.onPress = function() {  
this.onEnterFrame = function() {  
if (contentMain.\_x-speed\>finalContentPos) {  
if (scrollFace.\_x\>=right) {  
scrollFace.\_x = right;  
} else {  
scrollFace.\_x += speed/moveVal;  
}  
contentMain.\_x -= speed;  
} else {  
scrollFace.\_x = right;  
contentMain.\_x = finalContentPos;  
delete this.onEnterFrame;  
}  
};  
};  
btnDown.onRelease = function() {  
delete this.onEnterFrame;  
};  
btnDown.onDragOut = function() {  
delete this.onEnterFrame;  
};  
if (contentWidth\<maskWidth) {  
scrollFace.\_visible = false;  
btnUp.enabled = false;  
btnDown.enabled = false;  
} else {  
scrollFace.\_visible = true;  
btnUp.enabled = true;  
btnDown.enabled = true;  
}  
};  
scrolling();

Thanks in advance, i have supplied a jpeg of the error too if that helps.  
:bucktooth:
