A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: horizontal scroll please help

  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.

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

    working a little better but still some issues

    I'm attaching the file again, made some more updates to it but its still not working the way i want it to.

    currently the scrubber is not working together with the track (small light green square/w long rectangle) also i would like the image to load in the center of the mask and pan left and right from here. (not right or left aligned to to mask)

    also i would like the buttons to scroll continuously on press until the user releases the mouse button.

    I'm not experienced enough to pull this code apart I'm hoping someone can make some sense of this.
    Last edited by rkania; 06-20-2008 at 11:00 AM.

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

    horizontal scrollbar working but need some help

    ok I have the scroll working however I would like the image and the scrubber to load center justified so it can be scrolled left and right from the center point. the buttons move the image one click at a time is there any way make it a continuous scroll when pressing down on the button? can anyone help I'm attaching the file
    Attached Files Attached Files

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