5 Replies Latest reply on May 21, 2014 5:08 AM by robdillon

    Help needed for HSC project, urgent.

    Adam1996

      Hi,

      I am having further troubles. In my storybook on the first page all the buttons are appearing, I do not want this. How do I code to fix that, the only button I want on the first page is "page1_btn"

      will paste my coding into here, and could you please tell me what to do to fix this ?

       

      page2_btn.visible= false;
      p3_first_btn.visible= false;
      page1_btn.addEventListener(MouseEvent.CLICK,turnpage2);
      function turnpage2 (evt:MouseEvent):void {
        screen_movie.gotoAndPlay ("page2");
        page1_btn.visible = false;

      }

      page2_btn.visible= true; 
      page2_btn.addEventListener(MouseEvent.CLICK,turnpage3);
      function turnpage3 (evt:MouseEvent):void {
      screen_movie.gotoAndPlay ("page3");
      page2_btn.visible= false;

      }

      p3_first_btn.visible= true;
      p3_first_btn.addEventListener(MouseEvent.CLICK,turnpage3a);
      function turnpage3a (evt:MouseEvent):void {
      screen_movie.gotoAndPlay ("page3a");
      p3_first_btn.visible= false;

       

      }

       

       

      And, also the reason why I am setting the buttons to visible= true; at the start and visible= false; at the end is because I can only have one button for each page.

       

      Please help someone,

      Regards,
      Adam

        • 1. Re: Help needed for HSC project, urgent.
          Ned Murphy Adobe Community Professional & MVP

          There is no page1_btn in the code you show.  If you do not want any of the others to be visible then you need to set the visible property to be false.

          • 2. Re: Help needed for HSC project, urgent.
            robdillon Most Valuable Participant

            In your code you are:

            1. setting page2_btn and p3_first_btn to visible false, then you set an event listener and function for page1_btn.

            2. setting page2_btn to be visible true and setting an event listener and function for that button.

            3. setting p2_first_btn to be visible true and setting an event listener and function for that button.

             

            If all of this code is in the same frame, then you are turning all of the buttons' visible properties to true.

             

            If you only want one of those buttons to be visible at any one time then set the visible property for page2_btn to true at the end of the function turnpage2 and do the same for p2_first_btn.

             

            Something like this:

             

            page2_btn.visible= false;
            p3_first_btn.visible= false;
            page1_btn.addEventListener(MouseEvent.CLICK,turnpage2);
            function turnpage2 (evt:MouseEvent):void {
              screen_movie.gotoAndPlay ("page2");
              page1_btn.visible = false;

              page2_btn.visible= true; 

            }

             

            page2_btn.addEventListener(MouseEvent.CLICK,turnpage3);
            function turnpage3 (evt:MouseEvent):void {
            screen_movie.gotoAndPlay ("page3");
            page2_btn.visible= false;

            p3_first_btn.visible= true;

            }


            p3_first_btn.addEventListener(MouseEvent.CLICK,turnpage3a);
            function turnpage3a (evt:MouseEvent):void {
            screen_movie.gotoAndPlay ("page3a");
            p3_first_btn.visible= false;

            }

             

            You may have to make more changes, I'm guessing at what is going on in your movie.

            1 person found this helpful
            • 3. Re: Help needed for HSC project, urgent.
              Adam1996 Level 1

              Okay, going with this format solved the probel for a while. but now I have more problems, can you please help ?

              I want only page3a_1btn to be visible on page 3a_1

               

               

              import flash.events.MouseEvent;

              page2_btn.visible= false;
              p3_first_btn.visible= false;
              wood_button.visible=false;
              page1_btn.visible= true;
              page1_btn.addEventListener(MouseEvent.CLICK,turnpage2);
              function turnpage2 (evt:MouseEvent):void {
                screen_movie.gotoAndPlay ("page2");
                page1_btn.visible = false;
              page2_btn.visible= true;

              }


              page2_btn.addEventListener(MouseEvent.CLICK,turnpage3);
              function turnpage3 (evt:MouseEvent):void {
              screen_movie.gotoAndPlay ("page3");
              page2_btn.visible= false;
              p3_first_btn.visible= true;
              wood_button.visible= true;

              }


              p3_first_btn.addEventListener(MouseEvent.CLICK,turnpage3b);
              function turnpage3b (evt:MouseEvent):void {
              screen_movie.gotoAndPlay ("page3b");
              p3_first_btn.visible= false;
              wood_button.visible= false;

              }

              wood_button.addEventListener(MouseEvent.CLICK,turnpage3a);
              function turnpage3a(evt:MouseEvent):void { 
              screen_movie.gotoAndPlay ("page3a");
              wood_button.visible= false;
              p3_first_btn.visible= false;
              page3a_1btn.visible= true;

              }

              page3a_1btn.addEventListener(MouseEvent.CLICK,turnpage3a_1);
              function turnpage3a_1(evt:MouseEvent):void {
              screen_movie.gotoAndPlay ("page3a_1");
              page3a_1btn.visible= false;

              }

              • 4. Re: Help needed for HSC project, urgent.
                Adam1996 Level 1

                I also tried,

                 

                 

                import flash.events.MouseEvent;

                page2_btn.visible= false;
                p3_first_btn.visible= false;
                wood_button.visible=false;
                page1_btn.visible= true;
                page1_btn.addEventListener(MouseEvent.CLICK,turnpage2);
                function turnpage2 (evt:MouseEvent):void {
                  screen_movie.gotoAndPlay ("page2");
                  page1_btn.visible = false;
                page2_btn.visible= true;

                }


                page2_btn.addEventListener(MouseEvent.CLICK,turnpage3);
                function turnpage3 (evt:MouseEvent):void {
                screen_movie.gotoAndPlay ("page3");
                page2_btn.visible= false;
                p3_first_btn.visible= true;
                wood_button.visible= true;

                }


                p3_first_btn.addEventListener(MouseEvent.CLICK,turnpage3b);
                function turnpage3b (evt:MouseEvent):void {
                screen_movie.gotoAndPlay ("page3b");
                p3_first_btn.visible= false;
                wood_button.visible= false;
                page3a_1btn.visible= true;

                }

                wood_button.addEventListener(MouseEvent.CLICK,turnpage3a);
                function turnpage3a(evt:MouseEvent):void { 
                screen_movie.gotoAndPlay ("page3a");
                wood_button.visible= false;
                p3_first_btn.visible= false;

                }

                page3a_1btn.addEventListener(MouseEvent.CLICK,turnpage3a_1);
                function turnpage3a_1(evt:MouseEvent):void {
                screen_movie.gotoAndPlay ("page3a_1");
                page3a_1btn.visible= false;

                }

                 

                still no luck.

                • 5. Re: Help needed for HSC project, urgent.
                  robdillon Most Valuable Participant

                  You have 5 buttons. You only want one of those buttons available at any time. On the last page you don't want any buttons to show. Since you only have one button available on any page, the movement is sequential, so you only need to hide the previous button and show the current button. I'm guessing that the order of the pages is: page2, page3, page3b, page3a and page3a1. If that's the case then the code should "probably" look like this:

                   

                  import flash.events.MouseEvent;

                   

                  page1_btn.addEventListener(MouseEvent.CLICK,turnpage2);

                  page2_btn.addEventListener(MouseEvent.CLICK,turnpage3);

                  p3_first_btn.addEventListener(MouseEvent.CLICK,turnpage3b);

                  wood_button.addEventListener(MouseEvent.CLICK,turnpage3a);

                  page3a_1btn.addEventListener(MouseEvent.CLICK,turnpage3a_1);

                   

                  page1_btn.visible= true;

                  page2_btn.visible= false;

                  p3_first_btn.visible= false;

                  wood_button.visible=false;

                  page3a_1btn.visible= false;

                   

                  function turnpage2 (evt:MouseEvent):void {

                    screen_movie.gotoAndPlay ("page2");

                    page1_btn.visible = false;

                  page2_btn.visible= true;

                  }

                   

                  function turnpage3 (evt:MouseEvent):void {

                    screen_movie.gotoAndPlay ("page3");

                    page2_btn.visible= false;

                    p3_first_btn.visible= true;

                  }

                   

                  function turnpage3b (evt:MouseEvent):void {

                    screen_movie.gotoAndPlay ("page3b");

                    p3_first_btn.visible= false;

                    wood_button.visible= true;

                  }

                   

                  function turnpage3a(evt:MouseEvent):void { 

                    screen_movie.gotoAndPlay ("page3a");

                    wood_button.visible= false;

                    page3a_1btn.visible= true;

                  }

                   

                  function turnpage3a_1(evt:MouseEvent):void {

                    screen_movie.gotoAndPlay ("page3a_1");

                    page3a_1btn.visible= false;

                  }

                  1 person found this helpful