0 Replies Latest reply on Mar 16, 2007 2:37 PM by kumipantteri

    Draggable scrollbar

    kumipantteri
      I'm making a draggable scrollbar, with a mc containing five images.
      When dragging the scrollbar, the images appear one after one in
      the middle, the rest being unvisible outside of the document borders.

      My code so far is as follows:

      In the main timeline:

      shape.target_x = shape._x;
      shape.onEnterFrame = function() {
      var speed = 10;
      this._x += (this.targetWidth-this._x)/speed;
      };

      and inside the scrollbar mc:

      handle.onPress = function() {
      this.startDrag(false, 90, 0, 450, 0);
      };

      handle.onRelease = function() {
      this.stopDrag();
      };

      handle.onEnterFrame = function() {
      _root.shape.targetWidth = this._x+20;
      };

      The problem is, my document size is 300x250px, and the
      mc I'm scrolling is about five times wider, so all the images
      won't become visible before the scrollbar reaches the end.

      How do I make my scrollbar scroll the whole mc?