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

    Horizontal Scrollbar

    andrePT Level 1
      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

        • 1. Re: Horizontal Scrollbar
          kglad Adobe Community Professional & MVP
          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
            andrePT Level 1
            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 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-scrollFace._width+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, bottom, right);
            this.onMouseMove = function() {
            dy = Math.abs(scrollTrack_x-this._x);
            contentMain._x = Math.round(dy*-1*moveVal+initContentPos);
            scrollFace.onMouseUp = function() {
            delete this.onMouseMove;
            • 3. Re: Horizontal Scrollbar
              kglad Adobe Community Professional & MVP
              that code doesn't look right. there should be scrollbar movieclip that contains, at least, a slider movieclip and a track movieclip.