3 Replies Latest reply on May 13, 2010 5:27 PM by Ned Murphy

    Help needed regarding buttons :<

    popzorz

      Hi,


      I am making an intro to my website & I keep getting this weird error although I did similar stuff without this annoying glitch !!


      Anyway, the error is:


      TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at second3_fla::mc_Home_Butt_16/frame22()


      I think it's a common error but I have no idea why did it occur, it occured twice and here is the full pic so u can get what I mean


      In my 1st scene I have the pre-loader and a movie clip that should act as a container

      then I have the intro animation in a movie clip, in the end of it I have an event listener that refers to the second movieclip in the container

      The second movieclip plays normally untill it stops at a frame where I have two event Listeners:



      One for movieclip (Base)  that waits for a mouse out event to go to other frame

      And one for each of the three buttons I have there : Here the error occurs saying I can't refer to a null object.


      I want to put all of the button in a movie clip and that movie clip waits for a mouse_out event instead of the (Base) movieclip, but when I do that, I also get that error


      I really hope someone would tell me what's wrong or what should I do to get this to work since it's driving me craaaazy


      here is the code of the two simple event listeners, which I know there is nothing wrong with them, it's just the structure I guess.



      stop();

      Base.addEventListener(MouseEvent.MOUSE_OUT,gone);
      function gone(eventMouseEvent):void{
                                            gotoAndPlay('HomeFade');
      }

      Btn_home.addEventListener(MouseEvent.CLICK,url1);
      function url1(eventMouseEvent):void{
      navigateToURL(new URLRequest("http://www.yahoo.com"), "_self");
      }
         



      Thanks :<


        • 1. Re: Help needed regarding buttons :<
          Ned Murphy Adobe Community Professional & MVP

          The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....


           
          - is not in the display list
          - doesn't have an instance name (or the instance name is mispelled)
          - does not exist in the frame where that code is trying to talk to it
          - is animated into place but is not assigned instance names in every keyframe for it
          - is one of two or more consecutive keyframes of the same objects with different names assigned.
           
          If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.
          1 person found this helpful
          • 2. Re: Help needed regarding buttons :<
            popzorz Level 1

            Well, thanks for your reply


            maybe it's because " one of two or more consecutive keyframes of the same objects with different names assigned." but I really dunno how to be sure.


            But it's strange cause I can't even assign a url to the buttons, also can you please tell me why can't I add  an event listner to a  movie clip with some buttons inside it ?!?!?! And if it requires some special coding, please let me know the steps

             

            Thanks :>



            • 3. Re: Help needed regarding buttons :<
              Ned Murphy Adobe Community Professional & MVP

              To see if it might be what you think, name the objects in adjacent frames the same thing and that will resolve that issue.

               

              I don't know what you mean by "add a url to the buttons".

               

              You can add an event listener to any object that has an instance name.  If you have a movieclip that contains buttons and you assign some form of mouse interactive listeners to the movieclip, it will block the buttons from interacting with the mouse.