Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TypeError: Error #1009:

    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.displayisplayObjectContainer.

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

    Then on my menu I have:
    function buttonClick(event:MouseEvent):void
    {
    gotoAndStop(event.target.name);

    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!
    Last edited by ccbeneke; 02-25-2009 at 11:23 PM.

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    San Francisco
    Posts
    455
    Thanks
    19
    Thanked 15 Times in 15 Posts
    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?
    Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read. Groucho Marx

  • #3
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Oof!

  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Do you have a ; at the end of your addChild line?
    Code:
    var myLoader:Loader = new Loader();
    myLoader.load(new URLRequest("MAPC09_home.swf"));
    addChild(myLoader);
    or something different like

    Code:
    var myLoader:Loader = new Loader();
    var myRequest:URLRequest = new URLRequest("MAPC09_home.swf");
    myLoader.load(myRequest);
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #5
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    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.
    Code:
    event.target.enabled = true;
    newSWF = event.target.name + ".swf";
    trace(newSWF);
    this.parent.myLoader.load(new URLRequest(newSWF));
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #7
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #8
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Can you load your fla?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #9
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am placing two files in my public folder.
    http://idisk.mac.com/ccbeneke-Public?view=web

    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •