View Full Version : TypeError: Error #1009:

02-25-2009, 05:10 PM
Could someone please help me with my actionscript 3.0 code?

I am creating a flash website and have follow the instructions in my book to a t, but they won't work. Only the home file loads. The menu will not navigate to different states in its timeline, nor will it load anything other than the home file.

I keep getting this message:
1119: Access of possibly undefined property myLoader through a reference with static type flash.display:DisplayObjectContainer.

I have this code in scene 1:
var myLoader:Loader = new Loader();
myLoader.load(new URLRequest("MAPC09_home.swf"));

Then on my menu I have:
function buttonClick(event:MouseEvent):void

home.enabled = true;
exhi.enabled = true;
conf.enabled = true;
jour.enabled = true;
blog.enabled = true;
memp.enabled = true;
link.enabled = true;
cont.enabled = true;
abou.enabled = true;
memb.enabled = true;

event.target.enabled = true;
this.parent.myLoader.load(new URLRequest(event.target.name + ".swf"));

home.addEventListener(MouseEvent.CLICK, buttonClick);
exhi.addEventListener(MouseEvent.CLICK, buttonClick);
conf.addEventListener(MouseEvent.CLICK, buttonClick);
jour.addEventListener(MouseEvent.CLICK, buttonClick);
blog.addEventListener(MouseEvent.CLICK, buttonClick);
memp.addEventListener(MouseEvent.CLICK, buttonClick);
link.addEventListener(MouseEvent.CLICK, buttonClick);
cont.addEventListener(MouseEvent.CLICK, buttonClick);
abou.addEventListener(MouseEvent.CLICK, buttonClick);
memb.addEventListener(MouseEvent.CLICK, buttonClick);

Any ideas how I could edit this so that my code will allow the menu to navigate me to different pages?

I'd really appreciate any help. I am losing my mind!

02-25-2009, 10:24 PM
Have you considered moving all of the .enabled=true stuff to outside of the function? It looks like the buttons aren't considered buttons until after the buttonClick event hass been triggered, and since it's not a button yet, it doesn't trigger the buttonClick event. Kind of a Catch-22.

Also, did you name your frames?

02-25-2009, 11:18 PM
I tried moving the buttons outside of the function and that didn't seem to work. I still get the same error.

The frames are named with the same names as the buttons.


02-26-2009, 09:45 AM
Do you have a ; at the end of your addChild line?

var myLoader:Loader = new Loader();
myLoader.load(new URLRequest("MAPC09_home.swf"));

or something different like

var myLoader:Loader = new Loader();
var myRequest:URLRequest = new URLRequest("MAPC09_home.swf");

02-26-2009, 01:44 PM
Thanks, I do have the ; at the end of the addChild line. I tried your second option and I still get the same problem. Error type 1119. It seems to stem from this line of code within my menu movie.

this.parent.myLoader.load(new URLRequest(event.target.name + ".swf"));

Without this line the first page loads fine, but won't respond to any clicks.

With this line in, the first page does not load properly and the menu loops through every frame rather than loading the first and obeying the stop function.

02-26-2009, 02:56 PM
Sometimes I've found that its best to set your variables and then pass it to the URLReuqest function, and trace it so you know the variable is getting set right to help narrow things.

event.target.enabled = true;
newSWF = event.target.name + ".swf";
this.parent.myLoader.load(new URLRequest(newSWF));

02-26-2009, 05:24 PM
I tried that, but I still get the same problem. It just loops. Somehow it seems to override the effectiveness of any stop(); or gotoAndStop(); functions.

02-26-2009, 07:23 PM
Can you load your fla?

02-26-2009, 08:08 PM
I am placing two files in my public folder.

MAPC_site2 is the one that I have been asking about.

I decided to see if I could simplify things down and get rid of the nesting movieclip that was the navigation menu. I added those frames to the main timeline. But even this won't work. This file is called MAPC09Site3

Thanks so much for looking for me.