Link in Zwischenablage kopieren
Kopiert
Hello I'm looking for a way to remove the hand cursor that appears when you roll over a button
I'm working in html5 canvas
Thanks!
yourbutton.useHandCursor = false;
Link in Zwischenablage kopieren
Kopiert
yourbutton.useHandCursor = false;
Link in Zwischenablage kopieren
Kopiert
Thank you!
Where to place this code?
Link in Zwischenablage kopieren
Kopiert
in the actions panel at the keyframe where you want to disable the button's hand cursor.
Link in Zwischenablage kopieren
Kopiert
Hello, this seems to be needed even when a button is under another graphic, effectively creating an invisible button. I see that there's a way to intentionally cause this by not assigning key frames to any button states, but Hit. But is there a way to prevent the cursor from changing to a pointer when it is over a button that is under a graphic and not visible?
Link in Zwischenablage kopieren
Kopiert
yes, same solution.
Link in Zwischenablage kopieren
Kopiert
Ok, but just wondering, when a button isn't clickable or visible shouldn't it default to not showing a pointer? Shouldn't this be reported as a bug if a button that isn't visible, or clickable, still turns the cursor to a pointer?
Link in Zwischenablage kopieren
Kopiert
Ok, bug or not a bug aside, I'm still getting a hand pointer cursor when I apply the following at frame 1, (where I'm listening to each of 4 buttons):
Trigger_1.useHandCursor = false;
Trigger_2.useHandCursor = false;
Trigger_3.useHandCursor = false;
Trigger_4.useHandCursor = false;
Trigger_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_6);
function fl_ClickToGoToAndPlayFromFrame_6(event:MouseEvent):void
{
gotoAndPlay(2);
}
Am I missing something?
Link in Zwischenablage kopieren
Kopiert
maybe an overlying button?
test by assigning visibility to false to see if you still get a hand cursor on mouse over
Link in Zwischenablage kopieren
Kopiert
Ok, thanks again for your reply and your patience. I have to root through this some more since, somehow it's working for one, the 1st, button, but not the others. I didn't need to turn off visibity since my problem was that I had the assignments on the wrong side of a listener function. But I'll have to track down any differences that might explain why the same sequence isn't working for the other 3 buttons.
Link in Zwischenablage kopieren
Kopiert
Preventing the cursor from changing to the hand pointer still seems non-deterministic. Even if turning the button off helps, which I couldn't confirm, that causes a flash in a cross fade since there's no way to fade that out. I'll break it down into smaller exercises but, when the only place the HandCursor is set to true is at frame 1, could there be a circumstances that implicitly sets it back to true, without going to frame 1, after explicity setting it to false?
Link in Zwischenablage kopieren
Kopiert
as i understand your setup, you have objects overlying each other and you need help determining what object the cursor is responding to.
if that's true, toggling visibility will allow pinpointing the the object.
if it's not true, ignore the visibility tests.
Link in Zwischenablage kopieren
Kopiert
Yes, I do have an overlay that covers buttons when one of them is clicked, and the hand pointer seems to correspond to where the covered buttons are, even after setting the handcursor to false before playing the overlay sequence. It sounds useful to toggle visibility but, as I understand it, that involves setting the alpha to 100, where it may have been 0. But in this case, the button is occluded by another layer, so I'm not aware of something that allows a lower layer to be visible, even as an outline. Is there such a function? Also, is there a way to list all of the assets contained in a selected layer? I'd like to exclude the possibility of a stray duplicate button in a layer. If it's relevant, I had to turn off advanced layers since that seemed to be necessary to allow multiple buttons without needing to readdress them through a layer hierarchy.
Link in Zwischenablage kopieren
Kopiert
no, you misunderstand. (setting a buitton's alpha to 0 will NOT disable the handcursor, while setting its visible property to false WILL disable the handcursore)
first, make sure you save a copy of your current fla (with a new name, eg version number appended) in case the following steps cause unwanted clutter.
select the timeline/frame where your button is located and where there are overlying objects.
unlock all layers
using the selection tool drag a rectangle around the region on stage where you mouse changes to indicate a button.
right click over the selected objects>click distribute to layers
now make sure you can locate each of those layers because one of them contains the culprit
test to make sure the unwanted handcursor still appears
now, assign your button's useHandCursor property to false , if it's not already assigned at that timeline/frame
test.
still see the hand cursor? if so, you're ready to find the culprit
check the objects in those new layers. anything that's not a movieclip, graphic or button can be excluded from consideration. only those 3 objects can cause a mouse response.
for each object that's in one of those 3 categories, add its instance name (in the properties panel) to a list that you'll use to find the culprit. (if it has no instance name, assign one.)
then for each object in your list, assign them all visible property false.
test
you should not see a handcursor in the timeline/frame/stage location
now, comment-out about 1/2 those visible statements
test
if you see the cursor, the culprit's in the 1/2 that are still commented-out. if you don't see the cursor it's in the 1/2 that were active.
continue by 1/2 until you pinpoint the culprit. that should only take about n steps for 2**n objects in the list.
once you find the culprit, you can remove all the visible statements and assign that object's useHandCursor property to false
Link in Zwischenablage kopieren
Kopiert
BTW, this was resolved by switching to zero alpha overlay buttons that are only present when that menu is offered, rather than making the persistent graphic a button. Thanks again for your advice.
Link in Zwischenablage kopieren
Kopiert
you're welcome.
Link in Zwischenablage kopieren
Kopiert
useHandCursor is the ActionScript solution. In Canvas you use .cursor.
button.cursor = "pointer"; // hand cursor
button.cursor = "default"; // default cursor
You can set it to any CSS cursor type.
Link in Zwischenablage kopieren
Kopiert
Thank you! Very helpful hint about Canvas