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

Changing the cursor type (or not) depending on where the mouse is

Explorer ,
Jan 04, 2009 Jan 04, 2009
Ok, so I'm making a Myst-type game as a simple first application, and one of the things I need this to do is not have the arrow change to a finger when over a manipulable object. How do I either tell the program to change a certain cursor to another in a given context, or to keep it at default even in situations where it would not be so (over a link, etc)?

This is probably a step beyond the questions I've asked so far in complexity but I'm sure you gurus are up to it. 🙂
TOPICS
ActionScript
539
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
LEGEND ,
Jan 04, 2009 Jan 04, 2009
Give Sprite.buttonMode and Sprite.useHandCursor a looking over in the help documents.
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
Explorer ,
Jan 05, 2009 Jan 05, 2009
Ned. I checked out those two functions and they weren't quite what I was looking for for this. Actually, I determined it'd be best to have several different cursors, such as an arrow that points right when your mouse is on the right hand side (signifying to turn to the right), or forward (in a perspective sense) when your mouse is in the middle to signify go forward, and a generic arrow cursor when you are mousing in other areas that aren't objects.

I found tutorials for creating custom cursors using the "startDrag(true)" command but none of them show how to change it back. They are geared towards creating a special cursor that appears when you mouse over the entire application, functioning while you are moused over, and then being dropped off and still visible when you mouse off.

Obviously, the needs I specified would call for something that makes the custom cursor disappear and revert to the normal one when whatever special region was moused off. I've already made it so the "startDrag" command activates only when the button is moused over but I can't find a command that hides the custom mouse. I tried "stopDrag" but that just leaves the cursor at the edge of the button. I tried "specialcursor.hide()" (specialcursor is the instance name) but "hide" was apparently not a legit function despite it being so for Mouse.hide.

I'm a bit baffled, but perhaps you might know.
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
Explorer ,
Jan 05, 2009 Jan 05, 2009
LATEST
Ah! Figured it out!

Turns out I just had to say "specialcursor.visible=false;" to make it go away.

So the real question now is how to access the cursor from the library rather than from a layer on the stage so I don't have to have the thing sitting there beforehand.

Also you may or may not know this next one but I find if I move the mouse around rapidly, the custom cursor gets flickery and sometimes reverts to either the arrow or the pointing hand. Any way to remedy 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