• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Error #1009: Cannot access a property or method of a null object reference.

New Here ,
Jun 28, 2015 Jun 28, 2015

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!

TOPICS
ActionScript

Views

16.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 28, 2015 Jun 28, 2015

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.

Votes

Translate

Translate
LEGEND ,
Jun 28, 2015 Jun 28, 2015

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2015 Jun 28, 2015

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 11, 2015 Jul 11, 2015

Copy link to clipboard

Copied

<see duplicate thread for continued help>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 06, 2021 Jun 06, 2021

Copy link to clipboard

Copied

LATEST

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 10, 2015 Jul 10, 2015

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 11, 2015 Jul 11, 2015

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 04, 2016 Jun 04, 2016

Copy link to clipboard

Copied

Have some problem, my flash file  : Dropbox - flash.rar

please help

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 11, 2015 Jul 11, 2015

Copy link to clipboard

Copied

please don't cross-post.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines