Copy link to clipboard
Copied
So I make a as3 timeline. And this hapen
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at arrow_Scene1_fla::MainTimeline/frame2()
The code at frame 2 is
stop();
var myscore = 0;
score.text = "$" + myscore;
var mylive = 3;
live.text = "Live:" + mylive;
var myspin = 0;
spin.text = "Spin:" + myspin;
btn_play.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);
function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
{
gotoAndPlay(5);
}
btn_rule.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);
function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void
{
gotoAndPlay(3);
}
btn_credit.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_3);
function fl_ClickToGoToAndPlayFromFrame_3(event:MouseEvent):void
{
gotoAndPlay(4);
}
The bolded one is I suspect the cause.
Here's a thing
a) No matter what, when I'm making a variable for score. That message appear. Even a new file. ONLY
RARE CASE WHEN THAT MATTER DOESN'T MATTER.
Old file not affected, but new file does.
b) The bolded syntax, no matter where I move it, the error follows. The old frame err message gone
score, live or spin don't exist when your code executes.
to pinpoint the error, click file>publish settings>swf and tick "permit debugging" and retest. the problematic line number will be in the error message.
Copy link to clipboard
Copied
score, live or spin don't exist when your code executes.
to pinpoint the error, click file>publish settings>swf and tick "permit debugging" and retest. the problematic line number will be in the error message.
Copy link to clipboard
Copied
This appear
at arrow_Scene1_fla::MainTimeline/frame2()[arrow_Scene1_fla.MainTimeline::frame2:25]
My syntax was splitted into 2 layers. So None of my syntax reaches line 25
EDIT: I merge those 2 syntaxes. The error became
at arrow_Scene1_fla::MainTimeline/frame2()[arrow_Scene1_fla.MainTimeline::frame2:3]
The syntax in line 3 is
score.text = "$" + myscore;
Message was edited by: KerenzaDeo
EDIT2: I work it out . Thanks
Copy link to clipboard
Copied
score doesn't exist when you code executes.
check your frame 2 timeline and make sure if score exists in frame 1, there's not keyframe at frame 2 in the layer that contains score and make sure score is not part of a tween.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now