dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: scrolling menu? anyone?

  1. #1
    Junior Member
    Join Date
    Apr 2002
    Posts
    10
    Hi,

    Does anyone know of any tutorials that show you how to make a scrolling menu that has no visible buttons?

    They scroll based on where your mouse is. If you move it to the far left, they scroll quickly left, as you move toward center, they slow down or stop, as you move to the right they speed up and sroll right.

    I saw it on http://www.becominghuman.org which has an awesome flash presentation. at the end of each section they have the scrolling menu.

    Thanks,

    Nua


  2. #2
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    Set _root.midscreenposition to half the width of your screen, and set _root.speedsetting depending on how frantic you want the movement to be.

    Then have an onEnterFrame action for your scrolling menu:

    // This does the actual movement calc
    moveby = ( _root.midscreenposition - _root._xmouse )/_root.speedsetting;
    moveto += moveby;
    // /////////
    // This checks if you have scrolled off screen
    // Offset will need to be set according to your MC and
    // your tastes
    if (moveto < (offset - this._width)) {
    moveto = this._width - offset;
    } else if (moveto > (this._width - offset)) {
    moveto = offset - this._width;
    }
    // This does the actual movement
    this._x = moveto;

  3. #3
    Junior Member
    Join Date
    Apr 2002
    Posts
    10
    Thank you for the reply.

    I am new to flash, does this script go on the movie clip or is the movie clip a button??

    Thanks again for your help

    Nua

  4. #4
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    _root.midscreenposition and _root.speedsetting can be set anywhere, so just put them on the main flow line.

    When you have built the movie-clip that you want to scroll, drag it onto the stage and right-click it to open the Actions panel for the movie-clip itself, then paste the actions in there.

    Flash automatically creates an "onClipEvent" line when you do this. Select it and then change the event to "onEnterFrame" by clicking on the appropriate radio button.

    ///

    This method doesn't use buttons - it is comparing the position of the mouse with the midpoint every time Flash redraws the screen (onEnterFrame).

  5. #5
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749

    I had a couple of errors ...

    This one may be easier, all the config is in the onEnterFrame - adjust leftlimit and rightlimit and slowsetting to your tastes. Midpoint should be set to half the size of the movie screen.

    onClipEvent (enterFrame) {
    var midpoint;
    var moveto;
    var speedsetting;
    var leftlimit;
    var rightlimit;
    leftlimit = 240;
    rightlimit = 400;
    slowsetting = 10;
    midpoint = 275;
    moveto = this._x + ((_root._xmouse - midpoint) / slowsetting);
    if (moveto < rightlimit-this._width ) {
    moveto += this._width - leftlimit;
    } else if (moveto > leftlimit) {
    moveto -= this._width - leftlimit;
    }
    this._x = moveto;
    }

  6. #6
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749

    Oh and ...

    The MC is built out to the right of the centrepoint and you need to repeat some of the MC at each end to get seamless movement as if it were one continuous band.

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