9 Replies Latest reply on Feb 1, 2008 10:44 PM by kglad

    Help with Mouse Follower

    kebat
      First I would like you to forgive my poor english.
      I realize that my doubt is probably ridiculous but I'm tired of searching and not finding any help.

      I have a mouse follower that I want to move only in the vertical. So far so good. My follower is embed in an HTML page, in the left side of the page.
      My first problem is that, when I move the mouse out of the space occupied by the flash movie, the follower stop working. Is it possible to make it work?

      My second problem is that, when I move the mouse (inside the flash space) to the bottom, my follower (witch has 575px of height) almost disappears (I can only see the top of it).

      Can anyone help me?

      Thank you. My code is the following:
        • 1. Re: Help with Mouse Follower
          kglad Adobe Community Professional & MVP
          you can't track the mouse outside of the flash stage with as2. you'll need to use javascript.

          your second problem can be fixed by changing the registration point of your follower, changing its height or adjusting its movement.
          • 2. Re: Help with Mouse Follower
            kebat Level 1
            First thank you for helping me (again) but how do I do that?

            I've searched a lot of examples of mouse followers but all of them were very small. My follower has 202 px of width and 575 px of height. I've tried to change the registration point and the best results I had were with the registration point in the middle but the problem continues.

            Can you help me?
            • 3. Re: Help with Mouse Follower
              kglad Adobe Community Professional & MVP
              if the reg point is in the middle, at least, 1/2 your follower should be visible at all times. is it?
              • 4. Re: Help with Mouse Follower
                kebat Level 1
                No. My document has 2000px of height and if I have the mouse outside of the swf and pass on the bottom of the document, the follower almost disappears.
                • 5. Re: Help with Mouse Follower
                  kglad Adobe Community Professional & MVP
                  are you using javascript to have the follower track the mouse when the mouse is outside the flash stage?
                  • 6. Re: Help with Mouse Follower
                    kebat Level 1
                    No, I'm not using javascript.
                    I have no idea on how to do it.
                    I'm sorry but I'm still the same newbie in programing.
                    • 7. Re: Help with Mouse Follower
                      kglad Adobe Community Professional & MVP
                      if the reg point is in the middle, your follower must be, at least, 1/2 on-stage at all times. if you can't see it, something other than that code is preventing you from seeing it.
                      • 8. Help with Mouse Follower
                        kebat Level 1
                        I'm sorry. I wasn't testing with my latest version. You are absolutely right. I can see half of my follower when I pass the mouse in the bottom of my swf. The problem is that when the swf is loaded the follower also appears cut in half. Whenever I pass the mouse in the top or bottom of the swf, the follower is cut.

                        Do you know what can I do to make the follower stop before reaching the beginning or the end of the swf in order to stop it from being cut in half?

                        Do you know what kind of javascript I need to make the follower work without having to pass the mouse in the swf?

                        Thanks for your help.
                        • 9. Re: Help with Mouse Follower
                          kglad Adobe Community Professional & MVP
                          you can add an if-statement in your onEnterFrame loop that assigns the mouse position to be 1/2 the follower's height when the mouse position is less than that and similarly when the mouse is less the 1/2 the follower's height from the stage bottom.

                          use google to search for javascript and mouse detection. then use the externalinterface class in flash to communicate between the javascript and flash.