1 Reply Latest reply on Jun 21, 2007 8:36 AM by hciguy

    Error in code

    adamon
      I have run into this problem a couple of times in different parts of my code.
      I keep getting this error:

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at Main_final_fla::MainTimeline/onEnter().

      I am now trying to access a movie from my main timeline so that when the movie reaches frame 54, the main timeline goes to frame label begin.
      Here is the code that I am using on the main timeline:

      stop();


      introAnim.addEventListener(Event.ENTER_FRAME, onEnter);

      function onEnter(event:Event):void
      {
      if (introAnim.currentFrame >= 54)
      {
      gotoAndPlay("begin");
      }
      }

      Thanks for any help with this.

      Rob

        • 1. Re: Error in code
          hciguy Level 1
          It is trying to access something in your onEnter function that doesn't exist, or an object that doesn't have a certain property or method. Try commenting stuff out and see which of them makes the error go away. You need to isolate the problem. I can't say because I am not looking at the FLA. Comment out goToAndPlay. Does it still give you that error? If so then it may be your if clause. Comment the whole clause out and make sure there is nothing wrong with your function. That is what I do when I try to isolate an error. Maybe try just putting a trace in there that traces the currentFrame to be sure you're getting that info in there....

          Just what I'd do.