I know that many people have asked the same question, but i tried everything to solve it and i don't know what else to do. I understand that this error appears when an objects is being called while that objects is not available in the timeline anymore. I tried putting the AS3 code in a separate layer, and since the object is available only in frame (1) I only put the action script code in frame (1) but it still shows the same error message when it reaches frame (2).
TypeError: Error #1009: Cannot access a property or method of a null object reference. at naj_fla::MainTimeline/runMan()
stop();
addEventListener(Event.ENTER_FRAME, runMan);
function runMan(e:Event):void {
if (Loading_mc.currentFrame==Loading_mc.totalFrames) {
gotoAndPlay(2);
}
}
Your listener is still firing after you go to frame two, so try removing it first:
stop();
addEventListener(Event.ENTER_FRAME, runMan);
function runMan(e:Event):void {
if (Loading_mc.currentFrame==Loading_mc.totalFrames) {
removeEventListener(Event.ENTER_FRAME, runMan);
gotoAndPlay(2);
}
}