A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: horizontal scroll please help

Threaded View

  1. #1
    d3dpixle
    Join Date
    Sep 2005
    Location
    dirty jurz
    Posts
    47

    horizontal scroll please help

    ok so I have it scrolling left and right but the movie appears to the left of the mask and the scroll bar work a bit weird. here is my edited code:

    // This example illustrates how to create a scroll bar with momentum
    // There are two examples here one uses a movieclip within a mask
    // and the second uses a text field. The code covers both.
    // You my only want to use one or the other.



    // Initialize some variables for this clip
    box_mc.m = 0;
    box_mc.l = track_mc._x;
    box_mc.t = track_mc._y;
    box_mc.r = track_mc._x + track_mc._width - box_mc._width;
    box_mc.b = track_mc._y;
    box_mc.xPos = box_mc._x;
    box_mc.drag = false;
    box_mc.range = track_mc._width - box_mc._width;


    // These variables set the range for the scroll_mc
    box_mc.scroll_r = mask_mc._x;
    box_mc.scroll_l = mask_mc._x - ( scroll_mc._width + mask_mc._width );
    box_mc.scroll_range = scroll_mc._width + mask_mc._width;



    // Set up click and drag
    box_mc.onPress = function() {
    this.startDrag( false, this.l, this.t, this.r, this.b );
    this.drag = true;
    this.onMouseMove = function() {
    this.bx = this.ax;
    this.ax = this._x;
    this.set_scroll_pos();
    this.set_scroll_line();
    };
    };

    box_mc.onRelease = box_mc.onReleaseOutside = function() {
    this.stopDrag();
    delete this.onMouseMove;
    this.drag = false;
    this.xPos = this._x;
    this.m = this.ax - this.bx;
    };


    // Animates the clip
    box_mc.onEnterFrame = function() {
    if ( this.drag == false ) {
    this.m = this.m * .8;
    this.xPos += this.m;
    if ( this.xPos < this.l ) {
    this.xPos = this.l; // Stop at top
    this.m = -this.m; // Reverse motion
    }

    if ( this.xPos > this.r ) {
    this.xPos = this.r;
    this.m = -this.m; // this.m = this.m * -1;
    }

    this._x = this.xPos;

    // Set the position of scroll_mc
    this.set_scroll_pos();
    this.set_scroll_line();
    }
    };
    Last edited by rkania; 06-20-2008 at 11:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center