views:

40

answers:

1
+1  Q: 

Dang Error #1009 !

I'm building a simple flash site for a friend who has a spa.

I keep getting this error:

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

through the process of commenting out code, i've narrowed down to my link section:

vox_link.addEventListener(MouseEvent.CLICK,gotoVox);
function gotoVox(evtObj:Event):void {
    var voxSite:URLRequest=new URLRequest("http://www.voxmundiproject.com");
    navigateToURL(voxSite, "_blank");
}

With this section commented out, i don't get the 1009 error. When the code is active, I get the error.

My code syntax is correct so I'm stumped.

Does someone have an idea what my be wrong?

Thanks!

+1  A: 

The error says that you are using an object (accessing methods/properties) that is null. From what I see, it's probably vox_link that is null here or does not exist.

Shiki
yep, seems that's the problem. try `trace(vox_link)`
back2dos
ahhhh! i'm learning. the script for the links page was on frame one.... not the frame where the links actually were. i moved the code to the frame where my link buttons are and it seemed to fix the problem.i can not have code in frame one for an object that lives in another frame... or is there a way to have all my code in the same frame?
boz
I suppose you could put your "click" handler functions (gotoVox) in frame 1. And do the addEventListener() calls when the buttons already exist.
Shiki
But what would be so much better in terms of code manageability is to learn how to code "outside" the timeline: http://active.tutsplus.com/tutorials/actionscript/quick-tip-how-to-use-a-document-class-in-flash/
Shiki