3 Replies Latest reply on Feb 2, 2007 6:20 PM by kglad

# Horizontal Scrollbar

Hi everybody...i want to create a simple horizontal scroller for a movieclip but i can´t find any good tutorials for it...im new at this and i was wondering if someone could point me to some nice tutorials for this...all i find is vertical scrollbars :S

thanks
• ###### 1. Re: Horizontal Scrollbar
there's no significant different between vertical and horizontal scrollbars.

instead of the tob and bottion you use the left-most and right-most extent of the slider and the extremes of your scrolling object to create two linear equations in 2 unknowns to calculate how much your scrolling object should change with any change in your scrollbar.
• ###### 2. Re: Horizontal Scrollbar
thanks for the help but i cannot get it to work...i am a newbie at AS and i need to see an example of the code so i can study and understand! kglad....i understand what u said, the theory, but i cannot put it in practice :(

i have this code from a vertical scrollbar that i changed...but it doesnt work...i think its all wrong....can u guys help me out plz?

scrolling = function () {
var scrollWidth:Number = scrollTrack._width;
var contentWidth:Number = contentMain._width;
var scrollFacewidth:Number = scrollFace._width;
var initPosition:Number = scrollFace._x=scrollTrack._x;
var initContentPos:Number = contentMain._x;
var left:Number = scrollTrack._x;
var top:Number = scrollTrack._y;
var right:Number = scrollTrack._width-scrollFace._width+scrollTrack._x;
var bottom:Number = scrollTrack._y;
var dy:Number = 0;
var speed:Number = 10;

scrollFace.onPress = function() {
var currPos:Number = this._x;
startDrag(this, false, left, top, bottom, right);
this.onMouseMove = function() {
dy = Math.abs(scrollTrack_x-this._x);
contentMain._x = Math.round(dy*-1*moveVal+initContentPos);
}
}
scrollFace.onMouseUp = function() {
stopDrag();
delete this.onMouseMove;
}
}
scrolling();
• ###### 3. Re: Horizontal Scrollbar
that code doesn't look right. there should be scrollbar movieclip that contains, at least, a slider movieclip and a track movieclip.