6 Replies Latest reply on Apr 18, 2010 6:33 PM by Ned Murphy

    Flash Novice Needs Help

    k3gbb

      I am taking a Flash class and am stuck on a project that I am working on.  It is a simple 'click on the button and the image appears' layout.  I have include a simple action script with button actions.  What happens when I test the movie is as soon as I click on a button all of the images cycle through...there is no stop between images.

       

      Can anyone help me.  I have posted the .fla file at:

       

      http://public.me.com/k3gbb

       

      Thanks in advance.

       

      George B.

        • 1. Re: Flash Novice Needs Help
          Ned Murphy Adobe Community Professional & MVP

          If you show the code related to the button and the images someone may be able to help solve this with you.  Not all people will open files, so it's better to provide all your information in your posting.

          • 2. Re: Flash Novice Needs Help
            k3gbb Level 1

            Thank you, Ned...I will do that.

            • 3. Re: Flash Novice Needs Help
              k3gbb Level 1

              As requested, this is the ActionScript I have:

               

              stop();
              btn1_btn.addEventListener(MouseEvent.CLICK, showimage1);
              function showimage1(event:MouseEvent):void {
                  gotoAndPlay("Label1");
              }
              btn2_btn.addEventListener(MouseEvent.CLICK, showimage2);
              function showimage2(event:MouseEvent):void {
                  gotoAndPlay("Label2");
              }
              btn3_btn.addEventListener(MouseEvent.CLICK, showimage3);
              function showimage3(event:MouseEvent):void {
                  gotoAndPlay("Label3");
              }
              btn4_btn.addEventListener(MouseEvent.CLICK, showimage4);
              function showimage4(event:MouseEvent):void {
                  gotoAndPlay("Label4");
              }

              • 4. Re: Flash Novice Needs Help
                Ned Murphy Adobe Community Professional & MVP

                See if using gotoAndStop("label..."); does what you want instead of gotoAndPlay("label...");

                1 person found this helpful
                • 5. Re: Flash Novice Needs Help
                  k3gbb Level 1

                  Ok...making progress.  This did stop the movie from going through all of the images but I am still having problems.

                   

                  Frames 1-9 Nothing should happen as I want just the background to be displayed.  This is the script I have for those frames:

                   

                  stop();

                   

                  Beginning on Frame 10 I want to be able to click the buttons and have the image that is associated with that button displayed.  The script now reads:

                   

                  btn1_btn.addEventListener(MouseEvent.CLICK, showimage1);

                  function showimage1(event:MouseEvent):void {

                       gotoAndStop("Label1");

                  }

                  btn2_btn.addEventListener(MouseEvent.CLICK, showimage2);

                  function showimage2(event:MouseEvent):void {

                       gotoAndStop("Label2");

                  }

                  btn3_btn.addEventListener(MouseEvent.CLICK, showimage3);

                  function showimage3(event:MouseEvent):void {

                       gotoAndStop("Label3");

                  }

                  btn4_btn.addEventListener(MouseEvent.CLICK, showimage4);

                  function showimage4(event:MouseEvent):void {

                       gotoAndStop("Label4");

                  }

                   

                  So now the problem is I get the sound effect when I click on one of the buttons but the image associated with that button does not appear.

                   

                  Any more thoughts?

                   

                  George B.

                  • 6. Re: Flash Novice Needs Help
                    Ned Murphy Adobe Community Professional & MVP

                    That code needs to be where you want it to work.  I can't tell how you have things set up with the description you just gave.