I am trying to create a button using Actionscript. The only class which I found relevant was SimpleButton. When I had tried to insert a text field earlier, I found it was very simple and straighforward in that, I just created a text field, and added text to it. It got rendered fine.
However, when I tried to do something similar, I found that it wasn’t getting rendered. I referred to the help document on the Adobe Site and pasted their sample code as a standalone file. It worked fine. However, the button was just coloured. I wanted to add some text on it – so I used the text field and overlaid it. Which looks fine. But now when I bring the mouse close to the text, the button’s hover no longer works, nor does the click – This I believe is because of the text being over the button.
To summarise, how do I create a clickable button with text using Actionscript without problems?
If you want to use graphic interface to create button(s) do the following:
Componentswindow and expandUser interfacesection.Buttoncomponent thereSimpleButton is an Actionscript class meant to facilitate programmatic creation of the buttons.
If you find it more suitable for your needs just remember to set the overlaying text field to ignore the mouse events: