3 Replies Latest reply on Jul 11, 2009 1:34 PM by Ned Murphy

    Creating a Standard Button

    MattMazur

      I'm creating a basic navigation bar for my site and I want to create a common set of buttons that will be used to link to different sections on the site.

       

      I have no problem creating a rectangle with text, converting it to a symbol (button), and then duplicating it to create multiple, identical buttons.

       

      However, I don't understand how to change all of the buttons at once after they've been placed on the stage. For example, say I have 2 buttons and decide I want to change the font size for both buttons at once:

       

      twobuttons.png

       

      Is there an easy way to this?

        • 1. Re: Creating a Standard Button
          Ned Murphy Adobe Community Professional & MVP

          If they are two different library symbols, you'd have to edit them separately.

           

          There are some things you can take advantage of as far as objects go.  In the case where you have one button template as a library object, you use mutliple instances of that same button and whatever you change in the one will change in all.  The drawback there comes from them being buttons.   If you have text in the button it is the same in all the instances and you can't programmatically change it.  But if you make it a MovieClip symbol instead of a Button symbol you now have the ability to assign different text to each instance.

           

          So if you create your master button as MovieClip symbol with named textfield inside, you can change the textformat of the one in the libtrary and all will be impacted, but you can also assign different text labels to each instance in the coding.

          1 person found this helpful
          • 2. Re: Creating a Standard Button
            MattMazur Level 1

            Thanks.

             

            I'm having a bit of trouble doing what you said though (I'm very new to this).

             

            I created a rectangle and some text, grouped it together, and converted it to a MovieClip this time instead of a button.

             

            I then drag instances of the MovieClip onto the stage, but it doesn't seem like I can change text in one without it affecting the others.

             

            Also, by making them MovieClips, I lose the ability to set the different On, Over, & Down states, correct?

            • 3. Re: Creating a Standard Button
              Ned Murphy Adobe Community Professional & MVP

              When you create buttons using movieclips, you have to also create the code that controls them.  So you have frames for the different states, just like you would for a button, and you create the code that works with them for those states.

               

              When you rollover the movieclip you will have a frame for the rollover state and code that commands the movieclip to go to that frame,  The same for any other state you wanted to include.

               

              If you manually edit one of the movieclip's textfields, you will be editing all of the instances.  The key again is that you use code to assign the text so that all of the instances will have different text labels when you run the file.

               

              There are some people who will not use anything but movieclips as buttons, and have classes they create to make it an easy dealing.  If you were to post a question about it, you might get some useful information of how to approach it from a regimented approach.