2 Replies Latest reply on Aug 29, 2007 9:43 PM by crazygringo

    Best way to create dynamic buttons?

    crazygringo
      Hi, another "newbie" question I think...

      I'm creating an Internet app in Flash that will use several types of screens, and the main user-control element is buttons (For OK, Advance, Play, etc.)

      The standard button "component" doesn't work for me, because I need a very specific graphical look, with close control over the exact placement and operation of an icon on the button.

      So basically I want to "roll my own" buttons, using the Button object with my own graphics, and placing a caption and icon(s) on top. The buttons need to be dynamic, too, so I can create and delete them at will, change their captions, icons, etc...

      What is the best way for me to go about this, architecturally? My ideas so far:

      1) Use symbols for the buttons, and programatically create labels and graphics to put on top of them. Possible, but highly annoying, since I have to keep track of the positions of 3 elements together, for adding, deleting, modifying... I tried putting the label and graphics in the symbol, until I realized that you can't modify an individual instance...

      2) Create my own component. This looks like a huge hassle, though, that I'd rather avoid.

      Really, I'm just looking for a simple way to create and modify buttons dynamically with my own special graphics, ideally without all the overhead of components and everything... Are these two the only possiblities, or am I missing something else?

      Thanks
      Michael
        • 1. Re: Best way to create dynamic buttons?
          kglad Adobe Community Professional & MVP
          create a movieclip with whatever graphics are common to all your buttons and use a dynamic textfield for the buttons label. give the textfield an instance name and assign your movieclip to a class so you can dynamically instantiate it.

          if your icons are the different for each movieclip button, you can just add them as children of their parent movieclip button when the movieclip buttons are instantiated.
          • 2. Re: Best way to create dynamic buttons?
            crazygringo Level 1
            Ah hah, thank you. That's what I was looking for.

            So I can change a dynamic text field within an instance of a symbol if the symbol is a MovieClip.

            However, it seems I cannot change a dynamic text field within an instance of a symbol if the symbol is a Button?

            These idiosyncracies are driving me nuts :)

            Thanks