Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

TypeError: Error #1009: Variable

New Here ,
Aug 16, 2013 Aug 16, 2013

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

TOPICS
ActionScript
760
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 16, 2013 Aug 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.

Translate
Community Expert ,
Aug 16, 2013 Aug 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 16, 2013 Aug 16, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2013 Aug 16, 2013
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines