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.
- 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.
- 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.
- now add your event listeners and you’re ready to go.
About this entry
You’re currently reading “Getting a Hand With AS3,” an entry on Gena's Blurb
- Published:
- November 6, 2007 / 11:54 pm
- Category:
- Actionscript 3.0, Buttons, flash cs3
- Tags:
- actonscript 3, as3, button, buttonMode, child, children, Flash, flash cs3, movieclip, text
11 Comments
Jump to comment form | comment rss [?] | trackback uri [?]