Copy link to clipboard
Copied
I need a little help. I'm making a game, and everything works fine except for the fact that I have 2 errors, one that doesn't bother me as I can still use the button, but the other one won't let me use the button.
Error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Untitled_2_fla::MainTimeline/frame2()[Untitled_2_fla.MainTimeline::frame2:207]
at flash.display::MovieClip/gotoAndStop()
at Untitled_2_fla::MainTimeline/PlayBtn()[Untitled_2_fla.MainTimeline::frame1:13]
//Magyx Placement
RedAtk.addEventListener(MouseEvent.CLICK, RedAttack);
function RedAttack(Event:MouseEvent):void
{
gotoAndStop(19)
}
That's where Frane2:207 is, I don't see anything wrong with it, considering all my other ones are the same
nextBlueAtk.addEventListener(MouseEvent.CLICK, NWA);
function NWA(Event:MouseEvent):void
{
gotoAndStop(23)
}
nextGreyAtk.addEventListener(MouseEvent.CLICK, NGA);
function NGA(Event:MouseEvent):void
{
gotoAndStop(27)
}
nextGreenAtk.addEventListener(MouseEvent.CLICK, NGRA);
function NGRA(Event:MouseEvent):void
{
gotoAndStop(31)
}
I get no errors for those ones.
And frame1:13?
function PlayBtn(event:MouseEvent):void
{
gotoAndStop(2)
}
Someone please help, I want to continue working on this game!
1 Correct answer
When Flash tells you that there is a null object reference, it means that an object that you are referring to in a function is not available at that point in the movie. Usually this is a problem with the object not being in a particular frame. Make sure that the object, the button, is actually in the frame where the function reference is located.
Copy link to clipboard
Copied
When Flash tells you that there is a null object reference, it means that an object that you are referring to in a function is not available at that point in the movie. Usually this is a problem with the object not being in a particular frame. Make sure that the object, the button, is actually in the frame where the function reference is located.
Copy link to clipboard
Copied
Oh my gosh, I'm so dumb! I've only known AS3 for a two days and pretend I'm a master at it. I was coding on the wrong frame! Lol thank you so much. Time to fix my other games with this error.
Copy link to clipboard
Copied
<see duplicate thread for continued help>
Copy link to clipboard
Copied
I'm a bit confused. I have the same problem but I already do some change but it appeals same error. can help me too?
Copy link to clipboard
Copied
Have same problem. When the game is ended and then when i click the home button is says:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at KKK25_fla::MainTimeline/qwe()[KKK25_fla.MainTimeline::frame4:50]
can anyone help me?
Copy link to clipboard
Copied
It's the same problem. I'm guessing that you have several things listed in that mouse event function. You might need to change the order in which the actions are called. Can you show the code in that function?

Copy link to clipboard
Copied
Have some problem, my flash file : Dropbox - flash.rar
please help
Copy link to clipboard
Copied
please don't cross-post.

