Skip to main content
Participant
December 8, 2014
Answered

TypeError: Error #1009: Cannot access a property or method of a null object reference. at finalportfolio_fla::MainTimeline/rotating()

  • December 8, 2014
  • 1 reply
  • 428 views

MY code

stage.addEventListener(MouseEvent.MOUSE_MOVE,rotating);

function rotating(event:MouseEvent):void{

  album.rotationX=mouseY-50;

  album.rotationY=mouseX-50;

  if(album.rotationX>260){

  album.rotationX=259;

  }

  if(album.rotationY>445){

  album.rotationY=444;

  }

  if(album.rotationX<105){

  album.rotationX=106;

  }

  if(album.rotationY<285){

  album.rotationY=284;

  }

  trace("rotation    X " + album.rotationX);

  trace("mouse Y    " + (mouseY+50));

  trace("rotation Y    " + album.rotationY);

  trace("mouse X    " + (mouseX+50));

}

stage.addEventListener(MouseEvent.CLICK,changing);

function changing(event:MouseEvent):void{

  album.nextFrame();

}

This topic has been closed for replies.
Correct answer Ned Murphy

The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....

 

- is declared but not instantiated

- doesn't have an instance name (or the instance name is mispelled)

- does not exist in the frame where that code is trying to talk to it

- is animated into place but is not assigned instance names in every keyframe for it

- is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).

 

If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
December 8, 2014

The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....

 

- is declared but not instantiated

- doesn't have an instance name (or the instance name is mispelled)

- does not exist in the frame where that code is trying to talk to it

- is animated into place but is not assigned instance names in every keyframe for it

- is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).

 

If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.