...

View Full Version : TypeError: Error #1009



rickfink
02-18-2009, 05:38 PM
Trying to set up a flash slideshow/button script like this (http://www.prairielakeschurch.org/)one, but I keep getting this error when I run it:

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

I put the action script in a keyframe, I don't have the script right now since I'm at school, but I'll post it when I get home.

Any ideas to how I may fix it?

rickfink
02-18-2009, 07:07 PM
Here's my code:

import flash.events.MouseEvent;

home.addEventListener(MouseEvent.CLICK, link1);
function link1(event:MouseEvent) {
var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
navigateToURL(request, "_self");
}


sermon.addEventListener(MouseEvent.CLICK, link2);
function link2(event:MouseEvent) {
var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
navigateToURL(request, "_self");
}

youth.addEventListener(MouseEvent.CLICK, link3);
function link3(event:MouseEvent) {
var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
navigateToURL(request, "_self");
}

prayer.addEventListener(MouseEvent.CLICK, link4);
function link4(event:MouseEvent) {
var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
navigateToURL(request, "_self");
}

connect.addEventListener(MouseEvent.CLICK, link5);
function link5(event:MouseEvent) {
var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
navigateToURL(request, "_self");
}

jesus.addEventListener(MouseEvent.CLICK, link6);
function link6(event:MouseEvent) {
var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
navigateToURL(request, "_self");
}

marilynn.fowler
02-18-2009, 07:45 PM
Did you remember to name the buttons on all of the keyframes? For example, if a button appears on keyframe 1 and again on keyframe 7, they both need the names, otherwise when you click the unnamed button on keyframe 7 it won't know what to do. I've forgotten to name stuff a few times.

gnomeontherun
02-18-2009, 07:57 PM
Also I've noticed that sometimes you can't put that code until the frame of the button, so if you have a preloader or something this might throw errors.

marilynn.fowler
02-19-2009, 12:38 AM
He's right; if you've got the script on frame 2 but the buttons don't appear until frame 4, you'll get errors.

rickfink
02-19-2009, 04:16 AM
Yup that worked, but it in a separate keyframe and everything worked fine. Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum