Copy link to clipboard
Copied
Hi,
I get this error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Untitled_fla::MainTimeline/frame1()
And i think it is because of the fact that Actions are only in frame 1 and not in 2.
But how do i get Actions to work in frame 2 as well?
This is my code:
stop();
import flash.display.MovieClip;
import flash.events.MouseEvent;
var button1 : MovieClip =button1Mc;
var button2 : MovieClip =button2Mc;
button1.stop();
button2.stop();
button1.addEventListener(MouseEvent.CLICK,goto2);
button2.addEventListener(MouseEvent.CLICK,goto3);
function goto2(e:MouseEvent):void {
gotoAndStop(2,"Scene 1");
}
function goto3(e:MouseEvent):void {
gotoAndStop(1,"Scene 1");
}
Can anybody tell me how to get it to work?
Merel
Copy link to clipboard
Copied
if the error's from something in that code, either button1Mc or button2Mc don't exist when that code executes.
click file>publish settings>swf and tick 'permit debugging'. retest.
the problematic line number will be in the error message allowing you to pinpoint the problem and then correct it.
Copy link to clipboard
Copied
Thank you!
It works now. I figgured it out!
Have a nice day!
Copy link to clipboard
Copied
you're welcome.