2 Replies Latest reply on Nov 25, 2007 10:07 AM by 4pixels

    simple mouse follower

    4pixels
      I have used this script fine with flash player 5 (and still can), a long time ago, but it won't work with player 9 and I can't see what's wrong with the code. Its on frame 1 and 3 of a movie clip.

      frame.1
      physics = [0.25,0.6]

      frame.3
      xspeed = ((_parent._xmouse-_x)*physics[0])+(xspeed*physics[1]);
      _x += xspeed;
      gotoAndPlay(2);
        • 1. Re: simple mouse follower
          Rothrock Level 5
          This is so old school and there are probably better ways to do this now, but the simplest solution would be on frame 1 to add this:

          xspeed=0;

          Or whatever the original speed should be.

          I think it was at Flash 7 when you needed to initialize variables before you could use them. In earlier versions the value of xspeed (on the right hand side) the first time around would have defaulted to zero, but now it just doesn't compute at all.
          • 2. Re: simple mouse follower
            4pixels Level 1
            thank you Rothrock. I think I need to go back to school :-S