1 Reply Latest reply on May 30, 2007 5:20 PM by crazyjoemilan

    Floating Menu (Avoid Mouse)

    maverick21383
      I am trying to create a simple menu that basically floats on screen, and it moves opposite the mouse, speeding up as you move the mouse further from the menu. to recreate what i have so far, simple create a circle, convert to symbol (movie clip, named 'circle'). Then create a new layer and on the first frame, paste this in your Actions:

      _root.onEnterFrame = function(){
      positionX = _root._xmouse - 50;
      positionY = _root._ymouse - 50;
      circle._x = circle._x - (positionX - circle._x)/50
      }


      I have it floating just fine, moving from my mouse just as i want it, but unfortunately i cannot for the life of me figure out how to get it to stop at the document bounds. I have tried everything i can think of and have been searching tutorials all over the place but with no success. If anyone can help me out, i would greatly appreciate it. BTW, this is my first Flash project, so i'm new to the program and actionscripting, please bare with me. (btw, my motivation for this menu is the xmen 3 dvd site. . . http://www.xmenthelaststanddvd.com/# Once you click 'enter site', skip intro, and click the navigate button, you'll see what i mean).
        • 1. Re: Floating Menu (Avoid Mouse)
          crazyjoemilan Level 2
          this will control your _x, unless I misread what you were asking.

          _root.onEnterFrame = function(){
          positionX = _root._xmouse - 50;
          positionY = _root._ymouse - 50;
          if (positionX <= 0) {
          positionX = 0
          } else if (positionX >= Stage.width) {
          positionX = Stage.width
          }
          circle._x = circle._x - (positionX - circle._x)/50
          }