7 Replies Latest reply on Jan 24, 2011 2:54 PM by Ned Murphy

    Down Buttons

    Rama1234ish Level 1

      How do I get a down button to stay down after it is clicked.

        • 1. Re: Down Buttons
          Ned Murphy Adobe Community Professional & MVP

          Use a MovieClip instead of a button

          1 person found this helpful
          • 2. Re: Down Buttons
            maddec

            Hi there,

             

            You could use a Radio Button component and then skin it. Hence it is easier because you already have over states, disabled states, ... and all event dispatching are already available.

             

            Cedric M.

            • 3. Re: Down Buttons
              Rama1234ish Level 1

              How would I make that click able?

              • 4. Re: Down Buttons
                Ned Murphy Adobe Community Professional & MVP

                You assign mouse interactive code to it.  The code you use depends on the version of actionscript you are using.

                1 person found this helpful
                • 5. Re: Down Buttons
                  Rama1234ish Level 1

                  I have actionscript 3 and I do'nt really know how to put codes in.

                  • 6. Re: Down Buttons
                    Rama1234ish Level 1

                    I don't know if it makes a difference but I have CS5

                    • 7. Re: Down Buttons
                      Ned Murphy Adobe Community Professional & MVP

                      You'll probably need more learning/help than you might get here to get anywhere if you don't know how to code.  Try spending some time at lynda.com or find a book you can understand.

                       

                      The first thing you need to do to make it useful code-wise is to assign it a unique instance name.  So you drag a copy of it out to the stage from the library, and while it's still selected, you enter that unique instance name for it in the Properties panel... let's say you name it "btn1"

                      In AS3, to make a button or movieclip work with code, you need to add an event listener and event handler function for it.  You might need to add a few (for different events, like rollover, rollout, clicking it, but for now we'll just say you want to be able to click it to get a web page to open.  In the timeline that holds that button, in a separate actions layer that you create, in a frame numbered the same as where that button exists, you would add the event listener:

                       
                      btn1.addEventListener(MouseEvent.CLICK, btn1Click);

                       

                      The name of the unique function for processing the clicking of that button is specified at the end of the event listener assignment, so now you just have to write that function out:

                       
                      function btn1Click(evt:MouseEvent):void {

                         // do something

                        btn1.gotoAndStop("down");

                      }

                       

                      In that function you take care of whatever actions need to oocur relative to clicking the button, but since you want the button to stay in its down condition, you need to send it to stay t whichever frame you created within it for that state.