Skip to main content
safiahn40752198
Known Participant
December 13, 2015
Question

ActionScript 3 - cannot move to the next scene.

  • December 13, 2015
  • 1 reply
  • 1421 views

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at CompangleComplete_fla::MainTimeline/loop()[CompangleComplete_fla.MainTimeline::frame119:205]

I got this error.

When the player touch the "black rectangle", supposed to move to the next scene.

I try to check where is the problem, then I try this

if(endpoint==false){
if(player.hitTestObject(back.other)){

endpoint==true;
trace("next scene");}

the code run without error.

But then I try this,

if(endpoint==false){
if(player.hitTestObject(back.other)){

endpoint==true;
gotoAndPlay(2, "Scene 9");}

I got error like above.

The code for my gotoAndPlay(2, "Scene 9") is wrong. how i should change it?

This topic has been closed for replies.

1 reply

Inspiring
December 13, 2015

Correct the code and try:

if(endpoint==false){
if(player.hitTestObject(back.other)){

endpoint=true;
trace("next scene");}

the code run without error.

But then I try this,

if(endpoint==false){
if(player.hitTestObject(back.other)){

endpoint=true;
gotoAndPlay(2, "Scene 9");}

safiahn40752198
Known Participant
December 13, 2015

still give the same error.

Inspiring
December 13, 2015

Can you show the "loop" event listener & its function code?