5 Replies Latest reply on Jun 18, 2007 11:18 AM by kglad

    Button won't allow ActionScript

    JerAuf
      I'm learning Flash and trying to add ActionScript to a button. I've got the buttons defined and on the stage. When I select a button and open the Actions pane, where the code would normally go, it always says "Current selection cannot have actions applied to it."

      What am I doing wrong?
        • 1. Re: Button won't allow ActionScript
          kglad Adobe Community Professional & MVP
          are you double clicking the button? that would take you to the button editor where you cannot apply script to the button.

          click on an empty part of the main stage. click once on a button. now you should be able to add code to your button UNLESS you're working with as3.
          • 2. Re: Button won't allow ActionScript
            JerAuf Level 1
            I click once on the button in the scene, open the Actions panel, and it tells me that the current selection can't have actions applied to it. I've tried ActionScript 3 and ActionScript 1 & 2.

            So, I'm not sure why it's doing this. Any ideas?
            • 3. Re: Button won't allow ActionScript
              kglad Adobe Community Professional & MVP
              if your publication settings (file, publication settings, flash, actionscript) are for as3, you can't apply code to any object.

              if your publictions settings are for as1 or as2, what you think is a button, is not a button and it's not a movieclip.
              • 4. Re: Button won't allow ActionScript
                hoshihikari
                I have a problem with my button code. There are action script errors that appear once I try to test the movie. I see nothing wrong with the code and I gave the button an instance name already. The code and the errors are shown below. Could anyone help me?

                if (Button:IsPressed);
                {
                gotoAndPlay(nextScene);
                }
                else
                {
                gotoAndStop(scene);
                }

                //Errors:

                **Error** Scene=Scene 1, layer=button, frame=1:Line 1: ')' expected
                if (Button:IsPressed);

                **Error** Scene=Scene 1, layer=button, frame=1:Line 2: Statement must appear within on handler
                {

                **Error** Scene=Scene 1, layer=button, frame=1:Line 5: 'else' encountered without matching 'if'
                else
                • 5. Re: Button won't allow ActionScript
                  kglad Adobe Community Professional & MVP
                  1. Button:IsPressed isn't actionscript. i'm not sure what you want to test for here. do you want the goto actions to execute when a button is pressed?

                  2. don't use the goto functions and don't use scenes for navigation. label your frames and use the goto methods:

                  _root.gotoAndStop("scene2_frame1");