Skip to main content
Participant
July 20, 2015
Question

Keep getting Error #1009 Please help

  • July 20, 2015
  • 1 reply
  • 209 views

"TypeError: Error #1009: Cannot access a property or method of a null object reference.

  at TheUnseen_fla::MainTimeline/frameHandlers02()[TheUnseen_fla.MainTimeline::frame825:16]"

my code:

next.visible = false

var myStrings:String = "Well done, we now know the cause of death. A bullet to the heart. so we know that a gun was used in the murder. now all we need to do is have a look at these suspects we got in yesterday. I'll leave them in your care. Have Fun. ";

var myArrays:Array = myStrings.split("")

addEventListener(Event.ENTER_FRAME, frameHandlers02);

function frameHandlers02(event:Event):void {

  if (myArrays.length > 0) {

  textbox.appendText(myArrays.shift());

  } else {

   removeEventListener(Event.ENTER_FRAME, frameHandlers02);

  next.visible = true

  }

}

the scene will run perfectly by itself but when I play the whole document it gives that error, I have double checked naming and objects but still cannot find what is causing it.

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
July 20, 2015

If that is the beginning of the error message you see then the error is in line 16 of frame 825

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 declared but not instantiated

- 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 no name assigned in the preceding frame(s).