A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: More Horizontal Hell

  1. #1
    Junior Member
    Join Date
    Apr 2000
    Posts
    22
    Has anyone here tried turning Dan Ludwigs tutorial on effecient draggable scrolling into a horizontal scroller? If so and you were successful, hook me up. I feel so close, but I am missing something. I can't even get the stupid scroll button to move horizontal.

  2. #2
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    flash 5 actions:
    in frame 1 of the parent movieclip - the one that holds everything for the scrolling:

    left = scrollButton._x;
    scrollLength = scrollFill._width - scrollButton._width;
    right = left + scrollLength;
    textField = "put your text here"

    extend all of your layers out to frame 2, and put a stop action in frame 2 of the parent movieclip.

    on the instance of your scrollButton movieclip:

    onClipEvent (enterFrame) {
    if (scrolling) {
    _parent.textField.scroll = Math.ceil(((_parent.scrollButton._x-_parent.left)/_parent.scrollLength)*_parent.textField.maxscroll) ;
    }
    }

    and on the actual button instance inside the scrollButton movieclip:

    on (press) {
    startDrag (this, false, _parent.left, this_y, _parent.right, this._y);
    scrolling=1;
    }
    on (release) {
    stopDrag ();
    scrolling=0;
    }

    this is based on the same draggablescrollbars tut you were trying,
    I just adapted it from a post I made in the flash5 general forum this morning - replaced _y values with _x etc - if there are bugs post back.
    8)

    ps - you obviously won't be able to get text to scroll sideways using the .scroll and .maxscroll properties, you'll need to adjust stuff and play around a little to get what you want.

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