Skip to main content
Participant
August 16, 2013
解決済み

TypeError: Error #1009: Variable

  • August 16, 2013
  • 返信数 3.
  • 798 ビュー

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

このトピックへの返信は締め切られました。
解決に役立った回答 kglad

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.

返信数 3

kglad
Community Expert
kgladCommunity Expert解決!
Community Expert
August 16, 2013

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.

KerenzaDeo作成者
Participant
August 17, 2013

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

kglad
Community Expert
Community Expert
August 17, 2013

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.