Hello here is my code for my buttons for my rather simple Flash site. I have 5 "frame labels" each label contains a set of frames representing a page. Yet when I test the site with the action script below it freezes on the first frame and gives the message
Error #1009: Cannot access a property or method of a null object reference. at SelfPromoSite_fla::MainTimeline/frame1()
This is my code below for my main navigation buttons
Home_Btn.addEventListener(MouseEvent.MOUSE_DOWN, goHome);
function goHome(event:MouseEvent):void {
gotoAndPlay("Home");
}
About_Btn.addEventListener(MouseEvent.MOUSE_DOWN, goAbout);
function goAbout(event:MouseEvent):void {
gotoAndPlay("About");
}
Resume_Btn.addEventListener(MouseEvent.MOUSE_DOWN, goResume);
function goResume(event:MouseEvent):void {
gotoAndPlay("Resume");
}
Work_Btn.addEventListener(MouseEvent.MOUSE_DOWN, goWork);
function goWork(event:MouseEvent):void {
gotoAndPlay("Work");
}
Contact_Btn.addEventListener(MouseEvent.MOUSE_DOWN, goContact);
function goContact(event:MouseEvent):void {
gotoAndPlay("Contact");
}
Also on the "Work" "page" "set of frames" I have buttons to advance between frames.
button1.addEventListener(MouseEvent.MOUSE_DOWN, goBack);
function goBack(event:MouseEvent):void
{
prevFrame();
}
button2.addEventListener(MouseEvent.MOUSE_DOWN, goForward);
function goForward(event:MouseEvent):void
{
nextFrame();
}
I've tried putting this action script on the frame where the "Work" label starts and the actual buttons for advancing back and forth are located. I've also tried putting the action script for these buttons on the first frame with the remainder of the button action script above, it does not work. Also when I remove the 2nd set of actionscript altogether the site still freezes on the first frame.
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.
North America
Europe, Middle East and Africa
Asia Pacific