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 6 of 6
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    83
    Thanks
    4
    Thanked 0 Times in 0 Posts

    TypeError: Error #1009

    Trying to set up a flash slideshow/button script like this one, but I keep getting this error when I run it:

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

    I put the action script in a keyframe, I don't have the script right now since I'm at school, but I'll post it when I get home.

    Any ideas to how I may fix it?
    Last edited by rickfink; 02-18-2009 at 08:09 PM.

  • #2
    New Coder
    Join Date
    Jan 2009
    Posts
    83
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Here's my code:

    import flash.events.MouseEvent;

    home.addEventListener(MouseEvent.CLICK, link1);
    function link1(event:MouseEvent) {
    var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
    navigateToURL(request, "_self");
    }


    sermon.addEventListener(MouseEvent.CLICK, link2);
    function link2(event:MouseEvent) {
    var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
    navigateToURL(request, "_self");
    }

    youth.addEventListener(MouseEvent.CLICK, link3);
    function link3(event:MouseEvent) {
    var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
    navigateToURL(request, "_self");
    }

    prayer.addEventListener(MouseEvent.CLICK, link4);
    function link4(event:MouseEvent) {
    var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
    navigateToURL(request, "_self");
    }

    connect.addEventListener(MouseEvent.CLICK, link5);
    function link5(event:MouseEvent) {
    var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
    navigateToURL(request, "_self");
    }

    jesus.addEventListener(MouseEvent.CLICK, link6);
    function link6(event:MouseEvent) {
    var request:URLRequest = new URLRequest("http://www.baysidesuperior.org/Bayside/ministries.html");
    navigateToURL(request, "_self");
    }

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    San Francisco
    Posts
    455
    Thanks
    19
    Thanked 15 Times in 15 Posts
    Did you remember to name the buttons on all of the keyframes? For example, if a button appears on keyframe 1 and again on keyframe 7, they both need the names, otherwise when you click the unnamed button on keyframe 7 it won't know what to do. I've forgotten to name stuff a few times.
    Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read. Groucho Marx

  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Also I've noticed that sometimes you can't put that code until the frame of the button, so if you have a preloader or something this might throw errors.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • Users who have thanked gnomeontherun for this post:

    rickfink (02-19-2009)

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    San Francisco
    Posts
    455
    Thanks
    19
    Thanked 15 Times in 15 Posts
    He's right; if you've got the script on frame 2 but the buttons don't appear until frame 4, you'll get errors.
    Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read. Groucho Marx

  • #6
    New Coder
    Join Date
    Jan 2009
    Posts
    83
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Yup that worked, but it in a separate keyframe and everything worked fine. Thanks!


  •  

    Posting Permissions

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