Skip to main content
January 5, 2013
Question

Add textfield to button

  • January 5, 2013
  • 1 reply
  • 437 views

Hi

I've dynamically created a bunch of buttons from a single button class in the library, and now want to add different text over them. 

Should this be done with dynamic text fileds, or static ones (my text NEVER changes).  Or should I manually create different buttons in the IDE and manually add the text?

What is best practice?

Thanks guys

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
January 5, 2013

If you created them dynamically from a single button class in the library, then you have little choice but to use dynamic textfields and assign the text to them dynamically.  As long as you are creating a class file for the button you should be able to do this (SimpleButton objects do not have a textfield property that you can target... you have to extend them to have any)

Beyond that, if you would rather not create them dynamically and do it all manually in the IDE, that is up to you.  Best practice is often a well thought out design decision rather than something set in stone.  If these buttons need to have a number of uniquely different characteristics, then doing them individually might be the better approach.  If there a lots of them, it might make better sense to figure out how to manipulate one as a template for all others. You will probably find that using MovieClips instead of Buttons will provide more flexibility.