Skip to main content
Known Participant
February 19, 2013
Question

URGENT HELP!

  • February 19, 2013
  • 6 replies
  • 818 views

Hi guys i am trying to connect "scene 1" to "scene 2"

Then this ERROR comes out >>>  Cannot access a property or method of a null object reference.

You guys can check my Flash File at >>> http://www.filedropper.com/egg

Please help. When I only run the Scene 2 it plays but when i tried to connect it with scene 1. An ERROR comes out .

This topic has been closed for replies.

6 replies

Colin Holgate
Inspiring
February 19, 2013

It takes a moment for the things in scene 2 to settle down. You should wait one frame before setting up the enterframe function, or, in the enterframe function check to see if the bgA is ready yet. Like:

function onenter(e:Event):void {

if(bgA==null) return;

It's very strange to have two enterframe listeners. Not sure if it will work in all cases, so you might want to combine those two functions.

Known Participant
February 19, 2013

The other one is onenters it is for the egg that adds life.

The onenter is for the enemy/hurdle.

I input the code that you gave me but it still has the Cannot access a property or method of a null object reference. error.

Colin Holgate
Inspiring
February 19, 2013

You added both listeners to the stage. Can you add the egg enterframe listener to the egg?

As for the error, if you still see it you may have entered it in the wrong place.

If you go into publishing settings you can set the allow debugging option (it's under the advanced settings), then you will be told the line number where the error is happening.

Also, your button script needs to have this:

gotoAndStop(1, "Scene 2")

and not this:

gotoAndPlay(1, "Scene 1")