My goal is to simply have the cursor swap to be a hand (pointer) when I roll over a MovieClip. Obviously I could use SimpleButton, but the situation is that I have some enemies that are obviously MovieClips, and when I select an ability to use I want the mouse to show as a pointer when I roll over them.
I assumed this would work:
var mc:MovieClip = new MovieClip();
mc.graphics.beginFill(0);
mc.graphics.drawRect(0,0,50,50);
mc.graphics.endFill();
mc.useHandCursor = true; // <---- doesn't work?
addChild(mc);
mc.addEventListener(MouseEvent.CLICK, _click);
function _click(e:MouseEvent):void
{
trace('a');
}
There are workarounds such as adding a button into the enemy MovieClip and then removing it. Just seems there's an inbuilt way I'm missing.
Thanks.
I think it's mc.buttonMode = true;
Sometimes you will need to use also :
mc.mouseChildren=false;
To have handcursor over some movieclips, like movieclip with a textfield inside. -
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With