Another error - Null object reference | Member | | Join Date: Sep 2006
Posts: 68
| |
I'm getting this error when I try to preview my code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at therun4life_fla::MainTimeline/frame1()
I don't know what it could be. I looked over my code several times, and I can't find anything. Maybe it isn't sticking out because I put the code in. All of this code is in the first frame. Any idea what it could be? - stop();
-
-
about_mc.buttonMode = true;
-
//runners_mc.buttonMode = true;
-
interact_mc.buttonMode = true;
-
newsevents_mc.buttonMode = true;
-
support_mc.buttonMode = true;
-
-
home_btn.addEventListener(MouseEvent.CLICK, onHomeClick);
-
about_mc.addEventListener(MouseEvent.ROLL_OVER, aboutOver);
-
about_mc.addEventListener(MouseEvent.ROLL_OUT, aboutOut);
-
next_btn.addEventListener(MouseEvent.CLICK, onNextClick);
-
prev_btn.addEventListener(MouseEvent.CLICK, onPrevClick);
-
interact_mc.addEventListener(MouseEvent.ROLL_OVER, interactOver);
-
interact_mc.addEventListener(MouseEvent.ROLL_OUT, interactOut);
-
newsevents_mc.addEventListener(MouseEvent.ROLL_OVER, newseventsOver);
-
newsevents_mc.addEventListener(MouseEvent.ROLL_OUT, newseventsOut);
-
support_mc.addEventListener(MouseEvent.ROLL_OVER, supportOver);
-
support_mc.addEventListener(MouseEvent.ROLL_OUT, supportOut);
-
contact_btn.addEventListener(MouseEvent.CLICK, onContactClick);
-
send_btn.addEventListener(MouseEvent.CLICK, submit);
-
supporters_btn.addEventListener(MouseEvent.CLICK, onSupportersClick);
-
links_btn.addEventListener(MouseEvent.CLICK, onLinksClick);
-
privacy_btn.addEventListener(MouseEvent.CLICK, onPrivacyClick);
-
faq_btn.addEventListener(MouseEvent.CLICK, onFAQClick);
-
-
function onHomeClick(e:MouseEvent):void
-
{
-
gotoAndStop("home");
-
}
-
-
function aboutOver(e:MouseEvent):void
-
{
-
e.currentTarget.gotoAndPlay("over");
-
// about_mc.addEventListener(MouseEvent.ROLL_OUT, aboutOut);
-
}
-
-
function aboutOut(e:MouseEvent):void
-
{
-
e.currentTarget.gotoAndPlay("out");
-
// about_mc.enabled = false;
-
// about_mc.removeEventListener(MouseEvent.ROLL_OVER, aboutOver);
-
// about_mc.removeEventListener(MouseEvent.ROLL_OUT, aboutOut);
-
// var myTimer:Timer = new Timer(600,1);
-
// myTimer.addEventListener(TimerEvent.TIMER, enableAbout);
-
// myTimer.start();
-
}
-
-
//function enableAbout(e:TimerEvent):void
-
//{
-
// about_mc.enabled = true;
-
// about_mc.addEventListener(MouseEvent.ROLL_OVER, aboutOver);
-
//}
-
-
about_mc.dropdownAbout_mc.story_btn.addEventListener(MouseEvent.CLICK, onStoryClick);
-
about_mc.dropdownAbout_mc.founder_btn.addEventListener(MouseEvent.CLICK, onFounderClick);
-
about_mc.dropdownAbout_mc.runners_mc.addEventListener(MouseEvent.CLICK, onRunnersClick);
-
-
function onStoryClick(e:MouseEvent):void
-
{
-
gotoAndStop("story");
-
}
-
-
function onFounderClick(e:MouseEvent):void
-
{
-
gotoAndStop("founder");
-
}
-
-
function onRunnersClick(e:MouseEvent):void
-
{
-
gotoAndStop("runners");
-
}
-
-
function onNextClick(e:MouseEvent):void
-
{
-
gotoAndStop("jeremy");
-
}
-
-
function onPrevClick(e:MouseEvent):void
-
{
-
gotoAndStop("runners");
-
}
-
-
function interactOver(e:MouseEvent):void
-
{
-
e.currentTarget.gotoAndPlay("over");
-
// interact_mc.addEventListener(MouseEvent.ROLL_OUT, interactOut);
-
}
-
-
function interactOut(e:MouseEvent):void
-
{
-
e.currentTarget.gotoAndPlay("out");
-
// interact_mc.enabled = false;
-
// interact_mc.removeEventListener(MouseEvent.ROLL_OVER, interactOver);
-
/// interact_mc.removeEventListener(MouseEvent.ROLL_OUT, interactOut);
-
// var myTimer:Timer = new Timer(600,1);
-
// myTimer.addEventListener(TimerEvent.TIMER, enableInteract);
-
// myTimer.start();
-
}
-
-
//function enableInteract(e:TimerEvent):void
-
//{
-
// interact_mc.enabled = true;
-
// interact_mc.addEventListener(MouseEvent.ROLL_OVER, interactOver);
-
//}
-
-
interact_mc.dropdownInteract_mc.blog_btn.addEventListener(MouseEvent.CLICK, onBlogClick);
-
interact_mc.dropdownInteract_mc.guestbook_btn.addEventListener(MouseEvent.CLICK, onGuestbookClick);
-
interact_mc.dropdownInteract_mc.messageboard_btn.addEventListener(MouseEvent.CLICK, onMessageboardClick);
-
interact_mc.dropdownInteract_mc.networking_btn.addEventListener(MouseEvent.CLICK, onNetworkingClick);
-
-
function onBlogClick(e:MouseEvent):void
-
{
-
gotoAndStop("blog");
-
}
-
-
function onGuestbookClick(e:MouseEvent):void
-
{
-
gotoAndStop("guestbook");
-
}
-
-
function onMessageboardClick(e:MouseEvent):void
-
{
-
gotoAndStop("messageboard");
-
}
-
-
function onNetworkingClick(e:MouseEvent):void
-
{
-
gotoAndStop("networking");
-
}
-
-
function newseventsOver(e:MouseEvent):void
-
{
-
e.currentTarget.gotoAndPlay("over");
-
// newsevents_mc.addEventListener(MouseEvent.ROLL_OUT, newseventsOut);
-
}
-
-
function newseventsOut(e:MouseEvent):void
-
{
-
e.currentTarget.gotoAndPlay("out");
-
// newsevents_mc.enabled = false;
-
// newsevents_mc.removeEventListener(MouseEvent.ROLL_OVER, newseventsOver);
-
// newsevents_mc.removeEventListener(MouseEvent.ROLL_OUT, newseventsOut);
-
// var myTimer:Timer = new Timer(600,1);
-
// myTimer.addEventListener(TimerEvent.TIMER, enableNewsEvents);
-
// myTimer.start();
-
}
-
-
//function enableNewsEvents(e:TimerEvent):void
-
//{
-
// newsevents_mc.enabled = true;
-
// newsevents_mc.addEventListener(MouseEvent.ROLL_OVER, newseventsOver);
-
//}
-
-
newsevents_mc.dropdownNewsEvents_mc.articles_btn.addEventListener(MouseEvent.CLICK, onArticlesClick);
-
newsevents_mc.dropdownNewsEvents_mc.calendar_btn.addEventListener(MouseEvent.CLICK, onCalendarClick);
-
newsevents_mc.dropdownNewsEvents_mc.photos_btn.addEventListener(MouseEvent.CLICK, onPhotosClick);
-
newsevents_mc.dropdownNewsEvents_mc.video_btn.addEventListener(MouseEvent.CLICK, onVideoClick);
-
-
function onArticlesClick(e:MouseEvent):void
-
{
-
gotoAndStop("articles");
-
}
-
-
function onCalendarClick(e:MouseEvent):void
-
{
-
gotoAndStop("calendar");
-
}
-
-
function onPhotosClick(e:MouseEvent):void
-
{
-
gotoAndStop("photos");
-
}
-
-
function onVideoClick(e:MouseEvent):void
-
{
-
gotoAndStop("video");
-
}
-
-
function supportOver(e:MouseEvent):void
-
{
-
e.currentTarget.gotoAndPlay("over");
-
// support_mc.addEventListener(MouseEvent.ROLL_OUT, supportOut);
-
}
-
-
function supportOut(e:MouseEvent):void
-
{
-
e.currentTarget.gotoAndPlay("out");
-
// support_mc.enabled = false;
-
// support_mc.removeEventListener(MouseEvent.ROLL_OVER, supportOver);
-
// support_mc.removeEventListener(MouseEvent.ROLL_OUT, supportOut);
-
// var myTimer:Timer = new Timer(600,1);
-
// myTimer.addEventListener(TimerEvent.TIMER, enableSupport);
-
// myTimer.start();
-
}
-
-
//function enableSupport(e:TimerEvent):void
-
//{
-
// support_mc.enabled = true;
-
// support_mc.addEventListener(MouseEvent.ROLL_OVER, supportOver);
-
//}
-
-
support_mc.dropdownSupport_mc.donate_btn.addEventListener(MouseEvent.CLICK, onDonateClick);
-
support_mc.dropdownSupport_mc.membership_btn.addEventListener(MouseEvent.CLICK, onMembershipClick);
-
support_mc.dropdownSupport_mc.store_btn.addEventListener(MouseEvent.CLICK, onStoreClick);
-
support_mc.dropdownSupport_mc.volunteer_btn.addEventListener(MouseEvent.CLICK, onVolunteerClick);
-
-
function onDonateClick(e:MouseEvent):void
-
{
-
gotoAndStop("donate");
-
}
-
-
function onMembershipClick(e:MouseEvent):void
-
{
-
gotoAndStop("membership");
-
}
-
-
function onStoreClick(e:MouseEvent):void
-
{
-
gotoAndStop("store");
-
}
-
-
function onVolunteerClick(e:MouseEvent):void
-
{
-
gotoAndStop("volunteer");
-
}
-
-
function onContactClick(e:MouseEvent):void
-
{
-
gotoAndStop("contact");
-
}
-
-
function submit(e:MouseEvent):void
-
{
-
var variables:URLVariables = new URLVariables();
-
variables.fromname = name_txt.text;
-
variables.fromemail = email_txt.text;
-
variables.fromsubject = subject_txt.text;
-
variables.frommessage = message_txt.text;
-
-
var req:URLRequest = new URLRequest("contact.php");
-
req.data = variables;
-
req.method = URLRequestMethod.POST;
-
-
var loader:URLLoader = new URLLoader();
-
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
-
loader.addEventListener(Event.COMPLETE, sent);
-
loader.addEventListener(IOErrorEvent.IO_ERROR, error);
-
loader.load(req);
-
status_txt.text = "Sending...";
-
}
-
-
function sent(e:Event):void
-
{
-
status_txt.text = "Your email has been sent.";
-
name_txt.text = "";
-
email_txt.text = "";
-
subject_txt.text = "";
-
message_txt.text = "";
-
}
-
-
function error(e:IOErrorEvent):void
-
{
-
status_txt.text = "Error - please try again later.";
-
}
-
/**
-
var variables:URLVariables = new URLVariables();
-
var req:URLRequest = new URLRequest("contact.php");
-
var loader:URLLoader = new URLLoader;
-
req.method = URLRequestMethod.POST;
-
req.data = variables;
-
-
send_btn.addEventListener("click", submit)
-
-
function submit(e:MouseEvent):void
-
{
-
variables.fromname = name_txt.text;
-
variables.fromemail = email_txt.text;
-
variables.fromsubject = subject_txt.text;
-
variables.frommessage = message_txt.text;
-
loader.load(req);
-
-
//these next 4 lines are optional. I use them
-
//to clear out the textfields once the message is sent
-
// firstName.text = "";
-
// email.text = "";
-
// emailCT.text = "";
-
// messg.text = "";
-
}**/
-
-
function onSupportersClick(e:MouseEvent):void
-
{
-
gotoAndStop("supporters");
-
}
-
-
function onLinksClick(e:MouseEvent):void
-
{
-
gotoAndStop("links");
-
}
-
-
function onPrivacyClick(e:MouseEvent):void
-
{
-
gotoAndStop("privacy");
-
}
-
-
function onFAQClick(e:MouseEvent):void
-
{
-
gotoAndStop("faq");
-
}
| | Member | | Join Date: Nov 2008
Posts: 80
| | | re: Another error - Null object reference
Little bit of a long code to read here, so add some trace calls within your code to detect which line causes the null reference error.
Don't you see a line number in the error mesage?
|  | Similar Flash / Actionscript bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,537 network members.
|