9 Replies Latest reply on May 7, 2010 7:31 AM by kglad

    Help needed with buttons

    livn4change

      Okay, I have a movie that I have been working on.  There is a simple animation/intro and then a main frame with several buttons set up to jump ahead to other frames.  There are 4 buttons and they all work just fine and go to the respective frame with no problems.

       

      My problem is in trying to add a button to one of those frames.  I can't get any button to work on any of those frames at all.  I tried to add a "home" button that jumps back to the main frame, but that wouldn't work.  So, I tried to copy the main frame and move it ahead on the time line but that didn't work either.  I tried to add buttons for the other frames as well and no button would work (regardless of where it was referenced) on those other frames.

       

      Here is the error message I keep getting:

       

      Cannot access a property or method of a null object reference.

       

      Any suggestions?

        • 1. Re: Help needed with buttons
          kglad Adobe Community Professional & MVP

          if you have a button that first appears in frame 10, you can't reference that button in frame 1.  it doesn't exist (yet).

           

          there are several ways to handle this.  one is to add your frame 10 button to frame 1.  disable its visible property in frame 1 and enable it in frame 10.

          • 2. Re: Help needed with buttons
            livn4change Level 1

            Okay, "duh" to me.  I thought that my other buttons weren't introduced until frame 43 as well, but then went to double check that and they are all on frame 1.  So, I fixed that issue.  Now, I no longer get the error message, but the button still doesn't work.  Any other ideas?  Thanks for your help already.

            • 3. Re: Help needed with buttons
              kglad Adobe Community Professional & MVP

              if the button doesn't call its listener function when your on frame 43 it's because the button that is on frame 1 is not the same as the one on frame 43.

               

              before you start tracking down that error, make sure your button handler is not being called by using the trace() function.

              • 4. Re: Help needed with buttons
                livn4change Level 1

                Okay, so I went and I think I made sure that they are the same.  When I select the buttons on each respective frame, it says they are an "instance" of the same button, and they are named the same thing.

                 

                The one that I hid on the first frame works, but the one on the later frame still doesn't work.

                • 5. Re: Help needed with buttons
                  kglad Adobe Community Professional & MVP

                  that doesn't mean they're the same instance.

                   

                  if you take a library movieclip and drag it to the stage in frame 1, assign it an instance name (eg, mc) and then create a blank keyframe on frame 43, drag the same library movieclip to the stage and assign it the same instance name (mc), you have two different instances.

                  • 6. Re: Help needed with buttons
                    livn4change Level 1

                    Interesting.  How can I make sure it's the same button?  I went to one and chose the duplicate button (or symbol?) and then that is the symbol in my library that I used for the other button.  Is that wrong?

                     

                    I am very lost and frustrated here so I really appreciate your taking hte time to help me out.

                    • 7. Re: Help needed with buttons
                      livn4change Level 1

                      Okay, I may have just "got" it.  Do I hve to create the button in frame 1 and then make it visible in frame 43?  Going to try that.

                      • 8. Re: Help needed with buttons
                        livn4change Level 1

                        Thank you!  Thank you!  Thank you!

                         

                        That worked...now to finish the rest of my project...

                        • 9. Re: Help needed with buttons
                          kglad Adobe Community Professional & MVP

                          you're welcome.

                           

                          and, if you're still able, please mark this thread as answered.

                           

                           

                          for others, the only certain way to ensure all authoring-time created instances are the same is to:

                           

                          1.  create your object in its own layer in a keyframe with no other keyframes.  assign your object's instance name.  ONLY then can you add additionail keyframes.  do not remove your object from any of those additional keyframes because no matter what you do to replace it, that replacement will be a new instance.