Getting a Hand With AS3

Today i decided i needed to use a movieclip as a button using actionscript 3. Easier said then done.

I tried putting a movieclip on the stage and set it to ‘act as a button’ in the property inspector. Turns out that you can’t make it gotoAndPlay on another frame other then the default up, down, over, and hit states.

After doing some research i deleted the movieclip off the stage and dragged a new one out there. Then i followed these steps to make my movieclip button.

  1. Add buttonName.buttonMode = true; in the actions panel. This will allow the movieclip to have a hand cursor when rolled over. This is new for AS3.
  2. If you have text in the movieclip you have to add buttonName.mouseChildren = false; otherwise skip to step 3. This will allows anything contained in the main movieclip to allow the hand cursor as well.
  3. now add your event listeners and you’re ready to go.

About this entry