7 Replies Latest reply on May 13, 2014 6:27 PM by Adam1996

    Please help me, HSC major project, urgent

    Adam1996

      Hi,

      I am doing an interactive storybook for a HSC project. I am trying to code for it and it is telling me two error messages. These are 1120: Access of undefined property. I tried to insert a screenshot but it wont let me in this question. Maybe I message individual people the screenshot ?

      How do I fix this error message ?

       

       

      here is my code:

       

      stop();

      Page1_btn.addEventListener(MouseEvent.CLICK,turnpage2);

      function turnpage1 (evt:MouseEvent):void {

        screen_mov.gotoAndPlay ("Page2");

        page1_btn.visible = false;

      }

       

       

      So the pages are numbered starting at 1, 2,3 3, 4, 5, ..............................

      Screen_mov is the movie clip for the project containing all the pages/ graphics

      and page1_btn is the button for page 1

       

      PLEASE HELP THIS IS URGENT !

        • 1. Re: Please help me, HSC major project, urgent
          Ned Murphy Adobe Community Professional & MVP

          If that is the actual code you have in the file then you need to resolve whether you are going to use capital letters or not.  Page1_btn is not the same object as page1_btn.  The standard practice is to name instances starting with lowercase letters and use capital letters for the start of class names.  

          1 person found this helpful
          • 2. Re: Please help me, HSC major project, urgent
            Adam1996 Level 1

            Hi Ned,

            First off, thank you so much for replying, I will try to fix up the capital letter/s tomorrow when I am at school with access to Adobe software. I will keep you informed. Also, what is a 'class' ?

             

            Adam

            • 3. Re: Please help me, HSC major project, urgent
              Ned Murphy Adobe Community Professional & MVP

              A class is basically a definition for a type of object.  There are MovieClips, Sprites, TextFields, Numbers, Booleans, Events ... there's as many as you could imagine (literally, since you can create your own)

               

              See your own code where you use the term MouseEvent... that is defining the type/class you define for the listener and for the evt variable  argument for the function)

              1 person found this helpful
              • 4. Re: Please help me, HSC major project, urgent
                Adam1996 Level 1

                Hi Ned, I am now back to my project. After fixing these issues I can now click onto page 2. I will keep in touch if any problems. Thank you for your assistance

                 

                 

                Adam

                • 5. Re: Please help me, HSC major project, urgent
                  Adam1996 Level 1

                  Hi again, I now have input more code into my project & there is another error. Here is the code, could you please tell me what is wrong ?

                   

                  page2_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;

                   

                   

                  the error is syntax error: expecting rightbrace before end of program.

                  • 6. Re: Please help me, HSC major project, urgent
                    Ned Murphy Adobe Community Professional & MVP

                    If that is all the code then the error is telling you exactly what the problem is and where as well.

                     

                    I would also guess you don't really mean to be setting the button 2 visibility false and true in the same section of code like you show.

                    • 7. Re: Please help me, HSC major project, urgent
                      Adam1996 Level 1

                      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