8 Replies Latest reply on Sep 2, 2009 11:47 AM by gator1974

    button help


      I have made my first movie with flash.  I put a stop in the last frame to keep it from looping.  I would like to have a button to start the movie.  I have made two buttons, one start and the other stop.   I also have made the movie with a black screen to start by making a black rectangle and placing it at the beginning of the movie in the first two frames.


      So what I would like it to do is when the movie opens you see a black screen with the two buttons.   Click the start button and the movie starts and after the 2nd frame the black screen goes away and you see the movie play out.   The stop button is incase you want to stop the movie at some point.  If you do then the start button would start it again.


      I have found lots of info about how to make buttons but not very much on how to code them to do what I want.  using cs4.


      I read something that said I should take off the stop at the end of the movie and put one at the beginning.  That way it will loop back to the beginning and stop so the start button could start it again?


      Thanks for any help.

        • 1. Re: button help
          Ned Murphy Adobe Community Professional & MVP

          Your last mention of moving the stop is probably a good idea.  As far as the commands go for the button code, it's very simple.  The start button would have: play(); in the button function, and the stop button would have stop(); in its function.  As far as actual code goes, that depends on which version of actionscript you're using... CS4 can use any of them AS1 thru AS3.  You should be able to find out how to code buttons in any of them fairly easy thru these forums or the Flash help files.

          • 2. Re: button help
            gator1974 Level 1

            I took the stop off the last frame.  I have a layer called 'actions'.   In that layer on frame one

            I wrote



            stop ();
            btn1_btn.addEventListener(MouseEvent.CLICK, showframe3);
            function showframe3(event:MouseEvent):void {


            the movie doesn't stop it loops and the button does not work.


            any help thanks...

            • 3. Re: button help
              Ned Murphy Adobe Community Professional & MVP

              Usually, if things aren't working, and things just loop or otherwise don't obey code, there is a problem.


              Are your Publish Settings for Flash set to use AS3?  Are you getting any error messages?  Did you assign the instance name (btn1_btn) to the button in the Properties Panel?

              • 4. Re: button help
                gator1974 Level 1

                yes,I see an error that says


                1120: access of undefined property btn1_btn (which is what I named the button)


                then under source it says

                btn1_btn.addEventListener(MouseEvent.CLICK, showframe3);

                • 5. Re: button help
                  gator1974 Level 1

                  well I got it work ok.


                  part of the problem was the button named btn1_btn was not named in the properties panel.  Its a bit confusing however because apparenlty there are different views of the properties panel.   One of them being frame.  So I had it named in the frame properties panel but not the overall properties panel.

                  • 6. Re: button help
                    gator1974 Level 1

                    this is what I ended up with.  a start button and a stop button.


                    stop ();
                    btn1_btn.addEventListener(MouseEvent.CLICK, commence);
                    function commence(event:MouseEvent):void {
                    btn2_btn.addEventListener(MouseEvent.CLICK, halt);
                    function halt(event:MouseEvent) :void {
                    stop ()

                    • 7. Re: button help
                      Ned Murphy Adobe Community Professional & MVP

                      To get the correct view of the properties panel you have to select the object you intend to be working with.  You probably had the frame selected when the frame thing was showing.  When you select the button, the button's panel should be displayed.

                      • 8. Re: button help
                        gator1974 Level 1

                        That' exactly what happened. I named the frame instead of the button.