5 Replies Latest reply on Mar 15, 2007 11:36 AM by do1

    Scrolling

    do1
      Ive noticed a couple of scroll panes have some kind of delay effect on.

      Examples

      www.dcshoes.com
      http://www.roguestatus.com/
      http://www.themagicnumbers.net/
      http://www.onyro.com/new_2004.html

      if someone could email me an FLA of a scrollbar with this kind of motion i would be very grateful.

      packjallo@googlemail.com
        • 1. Re: Scrolling
          jthereliable Level 1
          The delay effect is very simple to make.
          You can google for a scrollbar and adjust the code as follows:
          After you drag and adjust where to move to, instead of quickly changing the x or y coordinate of the thing needed to be moved, change some placeholder like xx or yy.

          In the object that you want to adjust, include the xx and yy variables and in enterFrame, add this code:
          _x += (xx-_x)/DELAY
          _y += (yy-_y)/DELAY
          where DELAY is how much you want it to take to move there. Minimum is 1 (instant) and maximum is infinity.
          • 2. Re: Scrolling
            do1 Level 1
            i still cant seem to do this. is it possible you could send an FLA?
            • 3. Re: Scrolling
              kevicus
              post your actionscript and I'll tell you whats wrong in it.
              • 4. Re: Scrolling
                do1 Level 1
                ive tryed actionscript without knowing it, i need the fla not the actiopnscript. thanks anyway.
                • 5. Re: Scrolling
                  do1 Level 1
                  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.onRelease = 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;
                  }
                  };
                  scrolling();

                  Can someone add delay to this actionscript for my scrollbar soon please.