3 Replies Latest reply on May 5, 2008 12:09 AM by Lurya

    Horizontal Scrolling

    Lurya
      Hello!
      In the bottom of this message I have the script for vertical scrolling I use for scroll images beneath mask zone (with "ScrollFace" button and "Scrolltrack" line).
      I'd like to use some relative action script for a horizontal scroll. I've tried to change the "y" parameters to "x", the "Height" to "Width" and the "upbtn" or "downbtn" to "Leftbtn" and "Rightbtn" etc - that wouldn't help. It doesn't work. Is there a similar script for Horizontal scroling?
      Thakns.

      import mx.controls.List;
      scrolling = function () {

      var scrollHeight:Number = scrollTrack._height;
      var contentHeight:Number = contentMain._height;
      var scrollFaceHeight:Number = scrollFace._height;
      var maskHeight:Number = maskedView._height;
      var initPosition:Number = scrollFace._y=scrollTrack._y;
      var initContentPos:Number = contentMain._y;
      var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
      var left:Number = scrollTrack._x;
      var top:Number = scrollTrack._y;
      var right:Number = scrollTrack._x;
      var bottom:Number = scrollTrack._height-scrollFaceHeight+scrollTrack._y;
      var dy:Number = 0;
      var speed:Number = 10;
      var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-scrollFaceHeight);

      scrollFace.onPress = function() {

      var currPos:Number = this._y;
      startDrag(this, false, left, top, right, bottom);
      this.onMouseMove = function() {

      dy = Math.abs(initPosition-this._y);
      contentMain._y = Math.round(dy*-1*moveVal+initContentPos);

      };

      };
      scrollFace.onMouseUp = function() {

      stopDrag();
      delete this.onMouseMove;

      };
      btnUp.onPress = function() {

      this.onEnterFrame = function() {

      if (contentMain._y+speed<maskedView._y) {

      if (scrollFace._y<=top) {

      scrollFace._y = top;

      } else {

      scrollFace._y -= speed/moveVal;

      }
      contentMain._y += speed;

      } else {

      scrollFace._y = top;
      contentMain._y = maskedView._y;
      delete this.onEnterFrame;

      }

      };

      };
      btnUp.onDragOut = function() {

      delete this.onEnterFrame;

      };
      btnUp.onRollOut = function() {

      delete this.onEnterFrame;

      };
      btnDown.onPress = function() {

      this.onEnterFrame = function() {

      if (contentMain._y-speed>finalContentPos) {

      if (scrollFace._y>=bottom) {

      scrollFace._y = bottom;

      } else {

      scrollFace._y += speed/moveVal;

      }
      contentMain._y -= speed;

      } else {

      scrollFace._y = bottom;
      contentMain._y = finalContentPos;
      delete this.onEnterFrame;

      }

      };

      };
      btnDown.onRelease = function() {

      delete this.onEnterFrame;

      };
      btnDown.onDragOut = function() {

      delete this.onEnterFrame;

      };

      if (contentHeight<maskHeight) {

      scrollFace._visible = false;
      btnUp.enabled = false;
      btnDown.enabled = false;

      } else {

      scrollFace._visible = true;
      btnUp.enabled = true;
      btnDown.enabled = true;

      }

      };
      tod.addEventListener("scroll");scrolling();
        • 1. Re: Horizontal Scrolling
          kglad Adobe Community Professional & MVP
          this exact topic has been posted and answered within the past 2 days. search the forum for that thread.
          • 2. Re: Horizontal Scrolling
            Lurya Level 1
            Hey!
            Thanks for the direction. I've red the "scrolling bar longer when imported" thread (I hope that is the same thread you've mentioned before), and I tried. The scrollFace button does turn to right or left but the It doesn't move the "contentMain" movie clip (as I labeld it with the same name of course, to be the content that's slide under the mask). What I've got when I move the scrollFace button - the content disappear.
            Second, I'd like to make a custom change - I want the scrollface would be at the right side of the scrolltrack at start, in a matter that I'll scroll the bar from right to left.
            That's it I think, hope for help...
            • 3. Re: Horizontal Scrolling
              Lurya Level 1
              Please guys... I desperatley need for help...
              I'll make some reference to my destination:
              I need an Horizontal scrollbar which turn from right to left, as the content underneath the masked area would turn from right to left the same with the scroll button.
              Thanks a lot!