Reputation: 872
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);
};
Upvotes: 0
Views: 37409
Reputation: 3207
I took a look at your flash movie/application and the following is the solution to your problem:
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.
Upvotes: 3
Reputation: 6215
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!
Upvotes: 0
Reputation:
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.
Upvotes: 0