Skip to main content
Inspiring
July 25, 2011
Question

Why null object reference ?

  • July 25, 2011
  • 1 reply
  • 1944 views

I am trying to recieve a variable from one of my classes called secondss to the timeline.

I did this using MovieClip(root).secondss = secondss; in the class.

I wanted it for giving the user a different reward when finsihing the game in different amount of times.

I also created a var "TotalScore" which equals gameScore + reward.

And now when I run it and finish the game I see that there's a 0 in the textfield of TotalScore and I get this output error repeatedly :

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at EasyGame/clockTime()
    at EasyGame/showTime()

Anybody can clarify what's the problem ?

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
July 25, 2011

What is line 178 in the EasyGame.as file?

he11f1reAuthor
Inspiring
July 26, 2011

Line 178 : MovieClip(root).secondss = secondss;

Ned Murphy
Legend
July 26, 2011

Try putting a trace just before line 178 to see which object is not seen by the code.  If they both show up undefined/null, then you do not have a reference for the root:

    trace(MovieClip(root), MovieClip(root).secondss);