Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Custom Mouse, Hover Over Effect [AS2]

New Here ,
Aug 19, 2013 Aug 19, 2013

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

TOPICS
ActionScript
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2013 Aug 19, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 19, 2013 Aug 19, 2013

How can I tell using flash?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2013 Aug 19, 2013

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;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 19, 2013 Aug 19, 2013

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2013 Aug 19, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 19, 2013 Aug 19, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2013 Aug 19, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 19, 2013 Aug 19, 2013
LATEST

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines