PDA

View Full Version : TypeError: Error #1009


LN3000
11-09-2007, 09:48 PM
I'm new to Flash, and ActionScript3.

I'm trying to create a very basic "slideshow", when I compile, it runs, but I get the following error.

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

On that frame is the following ActionScript.

menu2.addEventListener(MouseEvent.CLICK,menu2Liste ner);
next2.addEventListener(MouseEvent.CLICK,next2Liste ner);
prev2.addEventListener(MouseEvent.CLICK,prev2Liste ner);

function menu2Listener(event:MouseEvent):void {
gotoAndPlay(2,"Menu");
}

function next2Listener(event:MouseEvent):void {
nextFrame();
}

function prev2Listener(event:MouseEvent):void {
prevFrame();
}

What's weird is, the nextFrame is working, but not the prevFrame button.
I am using scenes, and the scenes are being displayed properly.

My only problem is the error, and the prevFrame not working.

Please help out this AS3 n00b.

LN3000
11-10-2007, 06:40 AM
Well, I've finished my project, except for the actionScript.
I have a few extra buttons now, and sometimes a button will work, and sometimes it won't, while one of my new buttons won't work at all, similar to the button I'm using the prevFrame() on.

Anyone, please?

LN3000
11-10-2007, 08:38 AM
This should be something easy to solve, especially with all the very smart people on this forum. I am still looking around elsewhere on the internet, but no where seems to have the information I'm looking for.

Is there a genius in the house? Please?

LN3000
11-12-2007, 09:15 PM
This is really important.

Terrance
11-13-2007, 02:12 PM
You may be writing your code before the object is loaded in the timeline.

For example, you may be writing the code in the 1st frame, but your objects appear first on the 2cnd frame.

Hope it helps you, if you don't understand what I meant, just write here.

Regards

LN3000
11-14-2007, 03:13 AM
Thank you SO much for the reply.
I'll check into that, although I am not sure that's the problem.

I'll give that a check tonight, and respond later. Thanks again for the reply!

LN3000
11-14-2007, 11:02 PM
Nope. There's nothing like that there. I'm going to switch back to AS2.

matbury
11-14-2007, 11:08 PM
If you've got your code on the same timeline as the slideshow (1451+ frames!), this could be the reason you're having problems.

In this case, I'd convert the slideshow itself into self-contained MC, put it on a single framed SWF and control it from Actionscript on the SWF's timeline. That way, you only have to write your MC controller script once.

Hope this helps.