Skip to main content
Participating Frequently
March 2, 2010
Answered

Actionscript 3 Noob Question

  • March 2, 2010
  • 1 reply
  • 477 views

This is question number two for me today.

Using Actionscript 3

Have a button called "breckenridge".  I also have a scene called "breckenridge".

On a keyframe is the following code.

breckenridge.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler40);

function mouseDownHandler40(event:MouseEvent):void {

gotoAndPlay(1, "breckenridge");

}

When I test the movie and I press the "breckenridge" button it takes me to the "breckenridge" scene and stops on the the first frame.

Then I get the following error message

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at key_explore_fla::MainTimeline/frame302()

my main timeline, what I am assuming is my first scene called "aspen", stops at frame 300. What gives?

Okay, I know everyone hates scenes because it causes navigation problems.  However I have this .fla split into sections and I intend to add more stuff to each section in the future.  The easiest way I can think to organize these sections with out having a hodge podge of added stuff jumbled on one time line is to break it into scenes.

Thanks in advance for any help.

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

When you compile an fla into an swf, the compiler combines everything it into one timeline.  So 302 sounds about right based on what you said regarding the aspen scene.

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 not in the display list
- 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
- that you animate the object into place but do not assign instance names in every keyframe for it
- you have consecutive keyframes of instances of the same objects with different names assigned.

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
March 2, 2010

When you compile an fla into an swf, the compiler combines everything it into one timeline.  So 302 sounds about right based on what you said regarding the aspen scene.

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 not in the display list
- 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
- that you animate the object into place but do not assign instance names in every keyframe for it
- you have consecutive keyframes of instances of the same objects with different names assigned.

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.

mguiseAuthor
Participating Frequently
March 2, 2010

Correct answer!  Thanks!

Ned Murphy
Legend
March 2, 2010

You're welcome