0
votes

Flash is giving me this error after I click a button to go to another frame. After I get the error, some buttons do not go to its destination and instead it just does nothing.

The error is as follows:

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

Here is the code for frame 39:

stop();

winter_btn.addEventListener(MouseEvent.CLICK, buttonClick1);
function buttonClick1(event:MouseEvent):void{
gotoAndPlay(39);
};

spring_btn_boys.addEventListener(MouseEvent.CLICK, buttonClick10);
function buttonClick10(event:MouseEvent):void{
gotoAndPlay(114);
};

fall_btn_boys.addEventListener(MouseEvent.CLICK, buttonClick11);
function buttonClick11(event:MouseEvent):void{
gotoAndPlay(135);
}; 
3
Are winter_btn, spring_btn, and fall_btn defined in frame 39? Try to trace(fall_btn); and see what you get. - John Giotta
I'll take a look at the file. Upload it to a service like mediafire.com, and send the link via the contact form on my site (check my profile). - user1385191

3 Answers

3
votes

I took a look at your flash movie/application and the following is the solution to your problem:

.alt text

The above image is a screenshot of the timeline of your flash movie/application. It's at frame 39 that you recieve the error "TypeError: Error #1009: Cannot access a property or method of a null object reference. at wmhssports_fla::MainTimeline/frame39()". You recieve this because at that point the instance, spring_btn_girls, of your spring_btn button is null. To solve this give the instance of your spring_btn button the instance name "spring_btn_girls" on frame 34.

0
votes

One of the buttons you're linking to either doesn't exist (typo of instance name?) or isn't on the frame you're coding on.

As John said, try trace(winter_btn, spring_btn, fall_btn);. The one that returns null is the one that you want to rectify.

0
votes

You can actually set it up so it'll tell you what line of code is throwing the error. Here's a blog post I wrote on the subject: http://mykola.bilokonsky.net/2010/08/get-line-numbers-on-runtime-errors-in-flash/

Good luck!