473,372 Members | 824 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

Another error - Null object reference

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?

Expand|Select|Wrap|Line Numbers
  1. stop();
  2.  
  3. about_mc.buttonMode = true;
  4. //runners_mc.buttonMode = true;
  5. interact_mc.buttonMode = true;
  6. newsevents_mc.buttonMode = true;
  7. support_mc.buttonMode = true;
  8.  
  9. home_btn.addEventListener(MouseEvent.CLICK, onHomeClick);
  10. about_mc.addEventListener(MouseEvent.ROLL_OVER, aboutOver);
  11. about_mc.addEventListener(MouseEvent.ROLL_OUT, aboutOut);
  12. next_btn.addEventListener(MouseEvent.CLICK, onNextClick);
  13. prev_btn.addEventListener(MouseEvent.CLICK, onPrevClick);
  14. interact_mc.addEventListener(MouseEvent.ROLL_OVER, interactOver);
  15. interact_mc.addEventListener(MouseEvent.ROLL_OUT, interactOut);
  16. newsevents_mc.addEventListener(MouseEvent.ROLL_OVER, newseventsOver);
  17. newsevents_mc.addEventListener(MouseEvent.ROLL_OUT, newseventsOut);
  18. support_mc.addEventListener(MouseEvent.ROLL_OVER, supportOver);
  19. support_mc.addEventListener(MouseEvent.ROLL_OUT, supportOut);
  20. contact_btn.addEventListener(MouseEvent.CLICK, onContactClick);
  21. send_btn.addEventListener(MouseEvent.CLICK, submit);
  22. supporters_btn.addEventListener(MouseEvent.CLICK, onSupportersClick);
  23. links_btn.addEventListener(MouseEvent.CLICK, onLinksClick);
  24. privacy_btn.addEventListener(MouseEvent.CLICK, onPrivacyClick);
  25. faq_btn.addEventListener(MouseEvent.CLICK, onFAQClick);
  26.  
  27. function onHomeClick(e:MouseEvent):void
  28. {
  29.     gotoAndStop("home");
  30. }
  31.  
  32. function aboutOver(e:MouseEvent):void
  33. {
  34.     e.currentTarget.gotoAndPlay("over");
  35. //    about_mc.addEventListener(MouseEvent.ROLL_OUT, aboutOut);
  36. }
  37.  
  38. function aboutOut(e:MouseEvent):void
  39. {
  40.     e.currentTarget.gotoAndPlay("out");
  41. //    about_mc.enabled = false;
  42. //    about_mc.removeEventListener(MouseEvent.ROLL_OVER, aboutOver);
  43. //    about_mc.removeEventListener(MouseEvent.ROLL_OUT, aboutOut);
  44. //    var myTimer:Timer = new Timer(600,1);
  45. //    myTimer.addEventListener(TimerEvent.TIMER, enableAbout);
  46. //    myTimer.start();
  47. }
  48.  
  49. //function enableAbout(e:TimerEvent):void
  50. //{
  51. //    about_mc.enabled = true;
  52. //    about_mc.addEventListener(MouseEvent.ROLL_OVER, aboutOver);
  53. //}
  54.  
  55. about_mc.dropdownAbout_mc.story_btn.addEventListener(MouseEvent.CLICK, onStoryClick);
  56. about_mc.dropdownAbout_mc.founder_btn.addEventListener(MouseEvent.CLICK, onFounderClick);
  57. about_mc.dropdownAbout_mc.runners_mc.addEventListener(MouseEvent.CLICK, onRunnersClick);
  58.  
  59. function onStoryClick(e:MouseEvent):void
  60. {
  61.     gotoAndStop("story");
  62. }
  63.  
  64. function onFounderClick(e:MouseEvent):void
  65. {
  66.     gotoAndStop("founder");
  67. }
  68.  
  69. function onRunnersClick(e:MouseEvent):void
  70. {
  71.     gotoAndStop("runners");
  72. }
  73.  
  74. function onNextClick(e:MouseEvent):void
  75. {
  76.     gotoAndStop("jeremy");
  77. }
  78.  
  79. function onPrevClick(e:MouseEvent):void
  80. {
  81.     gotoAndStop("runners");
  82. }
  83.  
  84. function interactOver(e:MouseEvent):void
  85. {
  86.     e.currentTarget.gotoAndPlay("over");
  87. //    interact_mc.addEventListener(MouseEvent.ROLL_OUT, interactOut);
  88. }
  89.  
  90. function interactOut(e:MouseEvent):void
  91. {
  92.     e.currentTarget.gotoAndPlay("out");
  93. //    interact_mc.enabled = false;
  94. //    interact_mc.removeEventListener(MouseEvent.ROLL_OVER, interactOver);
  95. ///    interact_mc.removeEventListener(MouseEvent.ROLL_OUT, interactOut);
  96. //    var myTimer:Timer = new Timer(600,1);
  97. //    myTimer.addEventListener(TimerEvent.TIMER, enableInteract);
  98. //    myTimer.start();
  99. }
  100.  
  101. //function enableInteract(e:TimerEvent):void
  102. //{
  103. //    interact_mc.enabled = true;
  104. //    interact_mc.addEventListener(MouseEvent.ROLL_OVER, interactOver);
  105. //}
  106.  
  107. interact_mc.dropdownInteract_mc.blog_btn.addEventListener(MouseEvent.CLICK, onBlogClick);
  108. interact_mc.dropdownInteract_mc.guestbook_btn.addEventListener(MouseEvent.CLICK, onGuestbookClick);
  109. interact_mc.dropdownInteract_mc.messageboard_btn.addEventListener(MouseEvent.CLICK, onMessageboardClick);
  110. interact_mc.dropdownInteract_mc.networking_btn.addEventListener(MouseEvent.CLICK, onNetworkingClick);
  111.  
  112. function onBlogClick(e:MouseEvent):void
  113. {
  114.     gotoAndStop("blog");
  115. }
  116.  
  117. function onGuestbookClick(e:MouseEvent):void
  118. {
  119.     gotoAndStop("guestbook");
  120. }
  121.  
  122. function onMessageboardClick(e:MouseEvent):void
  123. {
  124.     gotoAndStop("messageboard");
  125. }
  126.  
  127. function onNetworkingClick(e:MouseEvent):void
  128. {
  129.     gotoAndStop("networking");
  130. }
  131.  
  132. function newseventsOver(e:MouseEvent):void
  133. {
  134.     e.currentTarget.gotoAndPlay("over");
  135. //    newsevents_mc.addEventListener(MouseEvent.ROLL_OUT, newseventsOut);
  136. }
  137.  
  138. function newseventsOut(e:MouseEvent):void
  139. {
  140.     e.currentTarget.gotoAndPlay("out");
  141. //    newsevents_mc.enabled = false;
  142. //    newsevents_mc.removeEventListener(MouseEvent.ROLL_OVER, newseventsOver);
  143. //    newsevents_mc.removeEventListener(MouseEvent.ROLL_OUT, newseventsOut);
  144. //    var myTimer:Timer = new Timer(600,1);
  145. //    myTimer.addEventListener(TimerEvent.TIMER, enableNewsEvents);
  146. //    myTimer.start();
  147. }
  148.  
  149. //function enableNewsEvents(e:TimerEvent):void
  150. //{
  151. //    newsevents_mc.enabled = true;
  152. //    newsevents_mc.addEventListener(MouseEvent.ROLL_OVER, newseventsOver);
  153. //}
  154.  
  155. newsevents_mc.dropdownNewsEvents_mc.articles_btn.addEventListener(MouseEvent.CLICK, onArticlesClick);
  156. newsevents_mc.dropdownNewsEvents_mc.calendar_btn.addEventListener(MouseEvent.CLICK, onCalendarClick);
  157. newsevents_mc.dropdownNewsEvents_mc.photos_btn.addEventListener(MouseEvent.CLICK, onPhotosClick);
  158. newsevents_mc.dropdownNewsEvents_mc.video_btn.addEventListener(MouseEvent.CLICK, onVideoClick);
  159.  
  160. function onArticlesClick(e:MouseEvent):void
  161. {
  162.     gotoAndStop("articles");
  163. }
  164.  
  165. function onCalendarClick(e:MouseEvent):void
  166. {
  167.     gotoAndStop("calendar");
  168. }
  169.  
  170. function onPhotosClick(e:MouseEvent):void
  171. {
  172.     gotoAndStop("photos");
  173. }
  174.  
  175. function onVideoClick(e:MouseEvent):void
  176. {
  177.     gotoAndStop("video");
  178. }
  179.  
  180. function supportOver(e:MouseEvent):void
  181. {
  182.     e.currentTarget.gotoAndPlay("over");
  183. //    support_mc.addEventListener(MouseEvent.ROLL_OUT, supportOut);
  184. }
  185.  
  186. function supportOut(e:MouseEvent):void
  187. {
  188.     e.currentTarget.gotoAndPlay("out");
  189. //    support_mc.enabled = false;
  190. //    support_mc.removeEventListener(MouseEvent.ROLL_OVER, supportOver);
  191. //    support_mc.removeEventListener(MouseEvent.ROLL_OUT, supportOut);
  192. //    var myTimer:Timer = new Timer(600,1);
  193. //    myTimer.addEventListener(TimerEvent.TIMER, enableSupport);
  194. //    myTimer.start();
  195. }
  196.  
  197. //function enableSupport(e:TimerEvent):void
  198. //{
  199. //    support_mc.enabled = true;
  200. //    support_mc.addEventListener(MouseEvent.ROLL_OVER, supportOver);
  201. //}
  202.  
  203. support_mc.dropdownSupport_mc.donate_btn.addEventListener(MouseEvent.CLICK, onDonateClick);
  204. support_mc.dropdownSupport_mc.membership_btn.addEventListener(MouseEvent.CLICK, onMembershipClick);
  205. support_mc.dropdownSupport_mc.store_btn.addEventListener(MouseEvent.CLICK, onStoreClick);
  206. support_mc.dropdownSupport_mc.volunteer_btn.addEventListener(MouseEvent.CLICK, onVolunteerClick);
  207.  
  208. function onDonateClick(e:MouseEvent):void
  209. {
  210.     gotoAndStop("donate");
  211. }
  212.  
  213. function onMembershipClick(e:MouseEvent):void
  214. {
  215.     gotoAndStop("membership");
  216. }
  217.  
  218. function onStoreClick(e:MouseEvent):void
  219. {
  220.     gotoAndStop("store");
  221. }
  222.  
  223. function onVolunteerClick(e:MouseEvent):void
  224. {
  225.     gotoAndStop("volunteer");
  226. }
  227.  
  228. function onContactClick(e:MouseEvent):void
  229. {
  230.     gotoAndStop("contact");
  231. }
  232.  
  233. function submit(e:MouseEvent):void
  234. {
  235.     var variables:URLVariables = new URLVariables();
  236.     variables.fromname = name_txt.text;
  237.     variables.fromemail = email_txt.text;
  238.     variables.fromsubject = subject_txt.text;
  239.     variables.frommessage = message_txt.text;
  240.  
  241.     var req:URLRequest = new URLRequest("contact.php");
  242.     req.data = variables;
  243.     req.method = URLRequestMethod.POST;
  244.  
  245.     var loader:URLLoader = new URLLoader();
  246.     loader.dataFormat = URLLoaderDataFormat.VARIABLES;
  247.     loader.addEventListener(Event.COMPLETE, sent);
  248.     loader.addEventListener(IOErrorEvent.IO_ERROR, error);
  249.     loader.load(req);
  250.     status_txt.text = "Sending...";
  251. }
  252.  
  253. function sent(e:Event):void
  254. {
  255.     status_txt.text = "Your email has been sent.";
  256.     name_txt.text = "";
  257.     email_txt.text = "";
  258.     subject_txt.text = "";
  259.     message_txt.text = "";
  260. }
  261.  
  262. function error(e:IOErrorEvent):void
  263. {
  264.     status_txt.text = "Error - please try again later.";
  265. }
  266. /**
  267. var variables:URLVariables = new URLVariables();
  268. var req:URLRequest = new URLRequest("contact.php");
  269. var loader:URLLoader = new URLLoader;
  270. req.method = URLRequestMethod.POST;
  271. req.data = variables; 
  272.  
  273. send_btn.addEventListener("click", submit)
  274.  
  275. function submit(e:MouseEvent):void
  276.     variables.fromname = name_txt.text;
  277.     variables.fromemail = email_txt.text;
  278.     variables.fromsubject = subject_txt.text;
  279.     variables.frommessage = message_txt.text;
  280.     loader.load(req);
  281.  
  282.      //these next 4 lines are optional. I use them 
  283.      //to clear out the textfields once the message is sent
  284. //     firstName.text = "";
  285. //     email.text = "";
  286.  //    emailCT.text = "";
  287.   //   messg.text = "";
  288. }**/
  289.  
  290. function onSupportersClick(e:MouseEvent):void
  291. {
  292.     gotoAndStop("supporters");
  293. }
  294.  
  295. function onLinksClick(e:MouseEvent):void
  296. {
  297.     gotoAndStop("links");
  298. }
  299.  
  300. function onPrivacyClick(e:MouseEvent):void
  301. {
  302.     gotoAndStop("privacy");
  303. }
  304.  
  305. function onFAQClick(e:MouseEvent):void
  306. {
  307.     gotoAndStop("faq");
  308. }
Jul 6 '09 #1
1 3783
serdar
88
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?
Jul 13 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: howie | last post by:
I've upgraded a vb6 application to vb .net and am having an issue. whenever I try to set the recordset property of the VB6.adodc object in .net and run the application I get the error “object...
18
by: Microsoft | last post by:
When I try this in my code I alwas get an errormessage: "Object reference not set to an instance of an object" Dim g As System.Drawing.Graphics g.DrawString("Test", New Font("Arial", 12,...
0
by: Martin Widmer | last post by:
Hello again! I have a datagridview control on my form and am using VS.Net 2005. One column is set up as combo box column, and when I try to set the datasource for that combobox column at design...
2
by: Beffmans | last post by:
Hi When I run this code: using System; namespace DelegateProject { public delegate void MyDelegate(string s);
1
by: brainstormer | last post by:
I'm new to this site and seeking help with an Error message. I have a program in HP called Image Zone. A few weeks ago all my photos disappeared and I got this error message..."Object reference not...
4
by: maddy1 | last post by:
HELLO when ever im trying to execute this, im getting an error as object reference not set to an instance of an object private void button2_Click(object sender, EventArgs e) { ...
1
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an...
3
by: Michel Couche | last post by:
Hello, I have an ASP.Net application that uses the Wizard control to build a newsletter. There are three steps in the wizard. The customer's specific design data are loaded from a database in...
2
by: =?Utf-8?B?QmFkaXM=?= | last post by:
I'm doing a server side automation(I know it's bad but..) and its working fine locally and when accessing it from a remote machine using web browser is was giving me this error"Retrieving the COM...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.