Flash Buttons Don't Work: TypeError: Error #1009: Cannot access a property or method of a null objec

Posted by goldenfeelings on Stack Overflow See other posts from Stack Overflow or by goldenfeelings
Published on 2010-06-01T08:08:04Z Indexed on 2010/06/01 8:13 UTC
Read the original article Hit count: 279

Filed under:
|
|
|
|

I've read through several threads about this error, but haven't been able to apply it to figure out my situation...

My flash file is an approx 5 second animation. Then, the last keyframe of each layer (frame #133) has a button in it. My flash file should stop on this last key frame, and you should be able to click on any of the 6 buttons to navigate to another html page in my website.

Here is the Action Script that I have applied to the frame in which the buttons exist (on a separate layer, see screenshot at: http://www.footprintsfamilyphoto.com/wp-content/themes/Footprints/images/flash_buttonissue.jpg

stop ();


function babieschildren(event:MouseEvent):void 
{ 
    trace("babies children method was called!!!");
    var targetURL:URLRequest = new URLRequest("http://www.footprintsfamilyphoto.com/portfolio/babies-children"); 
    navigateToURL(targetURL, "_self"); 
}

bc_btn1.addEventListener(MouseEvent.CLICK, babieschildren);
bc_btn2.addEventListener(MouseEvent.CLICK, babieschildren);


function fams(event:MouseEvent):void 
{ 
    trace("families method was called!!!");
    var targetURL:URLRequest = new URLRequest("http://www.footprintsfamilyphoto.com/portfolio/families"); 
    navigateToURL(targetURL, "_self"); 
}

f_btn1.addEventListener(MouseEvent.CLICK, fams);
f_btn2.addEventListener(MouseEvent.CLICK, fams);


function couplesweddings(event:MouseEvent):void 
{ 
    trace("couples weddings method was called!!!");
    var targetURL:URLRequest = new URLRequest("http://www.footprintsfamilyphoto.com/portfolio/couples-weddings"); 
    navigateToURL(targetURL, "_self"); 
}

cw_btn1.addEventListener(MouseEvent.CLICK, couplesweddings);
cw_btn2.addEventListener(MouseEvent.CLICK, couplesweddings);

When I test the movie, I get this error in the output box: "TypeError: Error #1009: Cannot access a property or method of a null object reference."

The test movie does stop on the appropriate frame, but the buttons don't do anything (no URL is opened, and the trace statements don't show up in the output box when the buttons are clicked on the test movie).

You can view the .swf file here: www.footprintsfamilyphoto.com/portfolio

I'm confident that all 6 buttons do exist in the appropriate frame (frame 133), so I don't think that's what's causing the 1009 error.

I also tried deleting each of the three function/addEventListener sections one at a time and testing, and I still got the 1009 error every time. If I delete ALL of the action script except for the "stop ()" line, then I do NOT get the 1009 error.

Any ideas?? I'm very new to Flash, so if I haven't clarified something that I need to, let me know!

© Stack Overflow or respective owner

Related posts about flash

Related posts about error