dcsimg
A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: [f8] mouseWheel scroll and click

  1. #1
    Member
    Join Date
    Apr 2008
    Posts
    65

    [f8] mouseWheel scroll and click

    Hi all, I'm wondering if you can help me tweak this. Thanks to sstalder for writing the following code. It's almost working the way I want it to but there is a little problem. I can go forward and backwards in all the frames exactly like I want to, except when you return to frame 1. Going forward from frame 1 on the second run causes it to select random frames when going forward. You can see what's happening here. Each icon that highlights is a different frame. I'd like the user to be able to scroll all the way forward and back as many time as they want. To add to it, I'd like to be able to left click to open a different swf on each icon/frame. I appreciate any input you can offer. Thanks.

    This is what I have in frame 1 on its own layer:

    var mouseWheel:Object = new Object();

    mouseWheel.onMouseWheel = function(direction:Object) {
    var max_frame:Number = _root._totalframes;
    var current_frame:Number = _root._currentframe;

    if((current_frame >= 1) && (current_frame <= max_frame)) {
    dir = (direction > 0) ? -1 : 1;
    current_frame += dir;
    if(current_frame < 1) current_frame = 1;
    if(current_frame > max_frame) current_frame = max_frame;

    trace("current_frame >> " + current_frame + " | max_frame >> " + max_frame + " | dir >>" + dir);
    _root.gotoAndStop(current_frame);
    }
    }

    Mouse.addListener(mouseWheel);
    Last edited by scadbrad; 05-05-2008 at 04:54 PM.

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