7 Replies Latest reply on Apr 9, 2008 2:02 PM by lindo_cafe

    onMouseMove help

    lindo_cafe
      I wrote code for a movieclip to move when my mouse moves, stop at certain points if my mouse goes beyond that boundary it stops. But my question is, if my mouse is stopped with in the bounderies i want the movieclip to stop also. here is my code.

      Now before this, i just used onMouseMove instead of onEnterFrame, but its not smooth at all. So how do i stop the movieclip? i cant find a function for it. Please help!
        • 1. Re: onMouseMove help
          kglad Adobe Community Professional & MVP
          use a boolean and boundary test to toggle your onEnterFrame so you're not repeatedly defining it. then delete your onEnterFrame when your mouse is outside that boundary and reset that boolean.
          • 2. Re: onMouseMove help
            lindo_cafe Level 1
            the boolean wont work in this situation because i need the movieclip to stop when the mouse stops, no matter where the mouse is on the stage. its driving me nuts :S
            • 3. Re: onMouseMove help
              FlashTastic Level 1
              Go back to using the onMouseMove code and at the end of the function
              add updateAfterEvent(). Then in the movie properties, increase your FPS to 24 - 30 and see if that makes a difference in smoothness.

              Cheers,
              FlashTastic
              • 4. Re: onMouseMove help
                kglad Adobe Community Professional & MVP
                you want the movieclip to stop tweening when the mouse stops moving?
                • 5. Re: onMouseMove help
                  lindo_cafe Level 1
                  Hey FlashTastic, i tried that, its alittle better but its still choppy, the client wont like it so i cant do that....

                  And kglad, i do want it to stop when the mouse stops and the move again when the mouse moves.

                  Ill show you guys another piece of code(i got from the internet) that does stop when the mouse stops, the only problem is i cant control the boundories of the movieclip, its only relative to the stage.

                  now the piece of code that says:
                  target.destX = Math.round(-((target._width-Stage.width)*mSpeed));
                  i know this controls the when it stops, but i need it to stop at the 280px mark then then at the 380px(bounderies)
                  did i explain it proper?
                  • 6. onMouseMove help
                    FlashTastic Level 1
                    Add this code directly after target.destX = Math.round(-((target._width-Stage.width)*mSpeed));

                    Cheers,
                    Flashtastic
                    • 7. Re: onMouseMove help
                      lindo_cafe Level 1
                      OMG FlashTastic Thanks!!! that makes so much sense, and it all work! thanks alot, now i gotta get the timing right... but thanks alot to everyone that helped out, (wat a simple way of doing it too) ... imma study harder
                      thanks all