Skip to main content
Participant
March 28, 2010
Answered

Error #1009 in Flash Menu for Website

  • March 28, 2010
  • 2 replies
  • 1596 views

I can't for the life of me seem to find the problem with this 1009 error.

I have a Flash Menu as a header for my website with the following actionscript:

//residential button
resBtn.addEventListener(MouseEvent.CLICK, resLink);
function resLink(event:MouseEvent):void {
    navigateToURL(new URLRequest("residential.html"));
}
//commercial button
commBtn.addEventListener(MouseEvent.CLICK, commLink);
function commLink(event:MouseEvent):void {
    navigateToURL(new URLRequest("commercial.html"));
}
//leisure button
leisBtn.addEventListener(MouseEvent.CLICK, leisLink);
function leisLink(event:MouseEvent):void {
    navigateToURL(new URLRequest("leisure.html"));
}
//home button
homeBtn.addEventListener(MouseEvent.CLICK, homeLink);
function homeLink(event:MouseEvent):void {
    navigateToURL(new URLRequest("home.html"));

Debugger returns with:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at introMenu_fla::MainTimeline/frame43()[introMenu_fla.MainTimeline::frame43:3]

All instances are correctly named and I get no syntax errors exporting from Flash.

It's only when I preview in browser or live preview in Dreamweaver that I get the error.

Is there Javascript or something that I'm missing? Any help would be gratefully received!!

Cheers

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

That error is poitning to line 3 of frame 43.  Do you happen to animate these objects into view using a timeline tween?  If so be sure you name the instances in all keyframes.

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
- 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 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.

2 replies

Ned Murphy
Ned MurphyCorrect answer
Legend
March 28, 2010

That error is poitning to line 3 of frame 43.  Do you happen to animate these objects into view using a timeline tween?  If so be sure you name the instances in all keyframes.

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
- 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 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.

Inspiring
March 28, 2010

Are you using MovieClip or Button Symbols for your buttons? Are they all in frame 1 with your code? When you play the file (CTRL+Enter) does the 1009 error occur?

gumbi595Author
Participant
March 28, 2010

Button Symbols. The flash is animated and then stopped at frame 43 with all buttons on individual layers / keyframes with the ActionScript in a keyframe on a separate layer.

The 1009 only occurs in the debugger and in Dreamweaver. Does not occur on playing in Flash or on export.

Inspiring
March 28, 2010

Better stay away from button symbols... there is a known bug with them if you have movieclips in them. Try to reconstruct your buttons as movieclips from scratch and see if it still prompts the error. A simple rectangle graphic is good for testing. Don't attempt to change the type in the library from Button to movieclip but create it from scratch.