A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Mousefollower VS Buttons :S

  1. #1

    Mousefollower VS Buttons :S

    I have a script that's working just the way I want it to, and it's taken a long time to create it. Once I finished, I noticed that no buttons would work outside the script area, as the script uses a mouse follower. is there any way to get around this? I would like for buttons to work outide this area, but still want the same effect with the script.

    To get a better idea of what I'm talking about, go here:
    http://www.andrewknapp.com/temp/port.swf
    The script is at the topleft (scrolling menu) and the big square thing at the bottom is the button that doesn't work.

    Thanks alot!

  2. #2
    Watch Your Head. GooseBump's Avatar
    Join Date
    Apr 2003
    Location
    The Resturant at the end of the Universe
    Posts
    431
    by a mouse follower do you mean you have an invisable movieclip that follows the mouse around in order to judge distance for the scroll effect? To be honest I'd have to see you fla to diagnose it.

  3. #3
    Hey...posted up the .fla here:
    http://www.andrewknapp.com/temp/port.fla

    And that's exactly what I mean by mousefollower: an invisable movieclip that follows the mouse around in order to judge distance for the scroll effect.

    Thanks

  4. #4
    Watch Your Head. GooseBump's Avatar
    Join Date
    Apr 2003
    Location
    The Resturant at the end of the Universe
    Posts
    431
    I'm running Flash 5, at least for the next week or two, so I was unable to open the fla. However I have a few suggestions.

    I'm guessing that you have a bit of code some where that is looping. That code detects where your "mousefollower" is and wether or not it should scroll the menu up or down or not at all.

    Here is what I would suggest.

    Create a variable call it anything you want on the first frame of your movie.
    Code:
    var myvariable = 0;
    like that. This creates a global variable called "myvariable" and set's it's value to "0".

    When the mouse leaves the scrollable area have your looping code set this variable to "1". It would look something like this if "mousefollower" is the name of your invisiable mouse-following movieclip and where "200" and "100" are the points at which the mouse leaves the scrolling area.
    Code:
    if (_root.mousefollower._y > 200 or _root.mousefollower._y < 100){
       _root.myvariable =1;
    } else {
       _root.myvariable =0;
    }
    Next in your following code you'll make a change. I'm assuming the code is on the mousefollower so that's where I'll put the change. On the movieclip "mousefollower" put the following code assuming the movieclip has the "follow" code on it. Below is both the change using the variable above and code to have it follow the mouse.
    Code:
    if (_root.myvariable == 1){
       stopDrag();
    } else {
      startDrag();
    }
    This should cause the "mousefollower" to only follow the mouse if it's within the scroll range. Also on your loop code create an "if" statment around the loop code so it's only active if the mouse is in the scroll range. For example if this was your loop code:
    Code:
    do{
       if (_root.viewer._y >= 1645) {
          _root.viewer._y = 1645;
       } else {
          _root.viewer._y = (_root.viewer._y+5);
       }
    }while (_root.viewer._y < 1645);
    This is not the same type of loop that you are using but it's the same idea. The _y of viewer is increased untill it reaches the top. However if we don't want this code to run while our mouse is out side the scroll area we put the following "if" statement around it like so:
    Code:
    if (_root.myvariable == 0){
       do{
          if (_root.viewer._y >= 1645) {
             _root.viewer._y = 1645;
          } else {
             _root.viewer._y = (_root.viewer._y+5);
          }
       }while (_root.viewer._y < 1645);
    }
    This way the code will only function if the mouse is in the appropriate area.

    What we have done is turned off all the code that functions when your scrolling throu the menu. The Key is to make sure the movieclip is NOT following the mouse anymore or it will prevent the mouse from interacting with your buttons. Hope that helps. If you can save the fla as a Flash 5 I'd be happy to take a look at it if not and you can wait a week or two I'll have '04 pro and take a look at it.

    good luck.

  5. #5
    Wow thanks so much GooseBump, I'll try this right now!

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