February 2010
M T W T F S S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728

Enabling MovieClips as button

Problem
Need to display movieclips as buttons/show users that it’s enabled or active, also assign a Click MouseEvent.

Solution
Using property buttonMode.

Detailed explanation

my_mc.buttonMode=true;
my_mc.addEventListener(MouseEvent.CLICK, gogogo);
function gogogo(event:MouseEvent):void{
trace("go");
}

Specifies the button mode of this sprite. If true, this sprite behaves as a button, which means that it triggers the display of the hand cursor when the mouse passes over the sprite and can receive a click event if the enter or space keys are pressed when the sprite has focus. You can suppress the display of the hand cursor by setting the useHandCursor property to false, in which case the pointer is displayed.

Please read more about buttonMode.

Source in attached files.

Source:
movieclip_thumb

Thank you for reading.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>