7 Replies Latest reply on Jan 22, 2010 7:52 AM by Sambo86

    follow mouse effect but how do i get it to go back when i roal away?

    Sambo86 Level 1

      Hi all!

       

      So i have been thinking that i want to get these balls to follow my mouse when you roll over parts of my site but i want them to go back to where they started when the mouse gets too far away!

      I was thinking of putting them in a movie and that when the mouse rolls off that movie then it floats back to where it started but cant seem to get it to work.

      i have this code that makes the ball follow your mouse and ease after it so it looks pretty cool but it only works with one and does not go back to where it came from?

       

      onClipEvent (load) {
          _x = 0;
          _y = 0;
          speed = 5;
      }
      onClipEvent (enterFrame) {
          endX = _root._xmouse;
          endY = _root._ymouse;
          _x += (endX-_x)/speed;
          _y += (endY-_y)/speed;
      }

       

       

      So the ball follows the mouse but will not go back to where it started.

       


      If anyone could help me that would be really great!!!

       

      Thanks in advance!