13

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.

Marty
  • 39,033
  • 19
  • 93
  • 162

3 Answers3

30

I think it's mc.buttonMode = true;

Marty
  • 39,033
  • 19
  • 93
  • 162
jhocking
  • 5,527
  • 1
  • 24
  • 38
17

Sometimes you will need to use also :

mc.mouseChildren=false;

To have handcursor over some movieclips, like movieclip with a textfield inside. -

Daelis
  • 45
  • 1
  • 11
Bartek
  • 1,986
  • 1
  • 14
  • 21
6

mc.buttonMode = true; You can use this,

this will works.

Benny
  • 2,250
  • 4
  • 26
  • 39