8 Replies Latest reply on Aug 19, 2013 1:55 PM by tx51chevy

    Custom Mouse, Hover Over Effect [AS2]

    ChristopherDavis

      Hi y'all,

      So I like the idea of a custom mouse pointer, but I really need to keep hover over effects.

       

      So this flash will be on top of my html page, so it looks cool, but I want people to still tell if they are on a link by displaying a mouse like the one you see when you hover over things.

       

      Does anyone have any ideas for how to do this?

       

      Thanks,

      Christopher

        • 1. Re: Custom Mouse, Hover Over Effect [AS2]
          kglad Adobe Community Professional & MVP

          when you're over a clickable item, replace your custom mouse pointer with a different mouse pointer.  when you're off a clickable item, replace with your default custom pointer.

          • 2. Re: Custom Mouse, Hover Over Effect [AS2]
            ChristopherDavis Level 1

            How can I tell using flash?

            • 3. Re: Custom Mouse, Hover Over Effect [AS2]
              kglad Adobe Community Professional & MVP

              Mouse.hide();

              offcursor._visible=true;

              oncursor._visible=false;

               

              this.onEnterFrame=function(){

              offcursor._x=oncursor._x=_xmouse;

              offcursor._y=oncursor._y=_ymouse;

              }

               

              //for each clickable object add rollover and rollout handlers

               

              whateverlink.onRollOver=function(){

              oncursor._visible=true;

              offcursor._visible=false;

              }

              whateverlink.onRollOut=function(){

              oncursor._visible=false;

              offcursor._visible=true;

              }

              • 4. Re: Custom Mouse, Hover Over Effect [AS2]
                ChristopherDavis Level 1

                Thank you for the information, kgland.

                 

                Unfortunately, my problem is more with how to figure out how to tell if there is a link.

                The links aren't in flash, and they already cause my default cursor to become a hand.

                I want that to happen to my custom cursor, too.

                 

                Everything is in html that I am trying to check for, which I don't think should matter.

                I just want to check what state my default cursor is in, and if it is on "Link Select" I want to use the link select custom mouse pointer.

                 

                Is there a way to check my mouse state like that?

                • 5. Re: Custom Mouse, Hover Over Effect [AS2]
                  kglad Adobe Community Professional & MVP

                  are you trying to control the cursor when it's not interactiving with your swf?

                  • 6. Re: Custom Mouse, Hover Over Effect [AS2]
                    ChristopherDavis Level 1

                    Yes.  That is exactly what I am trying to do.

                    The cursor can be effected by my swf, so I don't see why I can't change the custom cursor whenever I am over a hyperlink.

                    • 7. Re: Custom Mouse, Hover Over Effect [AS2]
                      kglad Adobe Community Professional & MVP

                      because your swf is not getting any information from your html page.

                       

                      you could use the externalinterface class to communicate between your html and swf files but there's no point.  you may as well control your cursor using javascript.

                      • 8. Re: Custom Mouse, Hover Over Effect [AS2]
                        tx51chevy Level 1

                        Good question... never done that before, but took a stab at it for you. Try the below out.

                        1. Change the movieName var to the name of your swf file.
                        2. Change the path to the correct scope and frame label of your cursor.
                          • thisMovie(movieName).TGotoLabel("_level0/myArrowMC/","normalState");

                         

                         

                         

                        <script language="JavaScript">

                        var movieName = "Untitled-1";

                        function thisMovie(movieName) {

                          // IE and Netscape refer to the movie object differently.

                          // This function returns the appropriate syntax depending on the browser.

                          if (navigator.appName.indexOf ("Microsoft") !=-1) {

                            return window[movieName]

                          }            else {

                            return document[movieName]

                          }

                        }

                        function movieIsLoaded (theMovie) {

                        // Checks if movie is completely loaded.

                          if (typeof(theMovie) != "undefined") {

                            return theMovie.PercentLoaded() == 100;

                          } else {

                            return false;

                          }

                        }

                        function mouseOver() {

                          if (movieIsLoaded(thisMovie(movieName))) {

                        thisMovie(movieName).TGotoLabel("_level0/myArrowMC/","hoverState");

                          }

                        }

                        function mouseOut() {

                          if (movieIsLoaded(thisMovie(movieName))) {

                        thisMovie(movieName).TGotoLabel("_level0/myArrowMC/","normalState");

                          }

                        }

                        </script>

                         

                        <a href="www.google.com" onMouseOver="mouseOver()" onMouseOut="mouseOut()">Google</a>