Skip to main content
Inspiring
Jun 14, 2021 3:13 PM UTC
Answered

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

Hello, so i have an end scene that just has a button that goes back to the first scene on frame 1559, which takes it back to 4 buttons, however when I click the go back button at the end scene and I arrive back at scene 1 with the 4 buttons, I get this error in the Output:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at workingonhellscene_fla::MainTimeline/frame1559()
at flash.display::MovieClip/gotoAndPlay()
at privatePkg::___LayerProp___$/executeFrameHelper()
at privatePkg::___LayerProp___/executeFrame()
at privatePkg::___LayerProp___/enterFrame()

I was wondering if someone knows why this is happening?
Here is my code for the button that goes back to scene 1:



I do need to keep advanced layers on, hence why my buttons on frame 1559 on scene 1 are coded like that. I hope someone can help me with this, as I am not experienced with coding, thank you.

    This topic is closed to new replies. Start a new post to keep the conversation going.
    defaulta9b2ymxec46iCorrect answer
    Inspiring
    Jun 14, 2021 4:38 PM UTC

    i've retested with debugging enabled, and now I got this.

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at workingonhellscene_fla::MainTimeline/frame1559()[workingonhellscene_fla.MainTimeline::frame1559:18]
    at flash.display::MovieClip/gotoAndPlay()
    at workingonhellscene_fla::MainTimeline/fl_ClickToGoToScene_3()[workingonhellscene_fla.MainTimeline::frame6188:22]

     

    frame1559:18 is button1.addEventListener(MouseEvent.CLICK, clickHandler1);

    workingonhellscene_fla::MainTimeline/fl_ClickToGoToScene_3() is my credit scene button that goes back to frame 1559.

    and frame 6188 is non-existent, my friends dont up to that much even!

     

    I'm sorry to be a pain man, but I really dont understand what I'm doing wrong.


    I got it to work! I just made the button go a few frames before 1559, it looks like 1559 was too close to the buttons showing up (Which was 1560!) thank you for the help regardless kglad!

    5 replies

    Inspiring
    Jun 14, 2021 3:17 PM UTC

    I forgot to mention that the when I get taken back to the buttons, the buttons are not clickable.

    Translate
    kglad
    Community Expert
    Community Expert
    Jun 14, 2021 3:55 PM UTC

    on frame 1559 you're trying to use an object reference that doesn't exist (when the code executes).  if you enable debugging (file>publish settings>flash (swf)>advanced>enable debugging), and retest you'll see an error message that includes the line number of the problematic reference.

    Translate
    Inspiring
    Jun 14, 2021 4:09 PM UTC

    i've retested with debugging enabled, and now I got this.

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at workingonhellscene_fla::MainTimeline/frame1559()[workingonhellscene_fla.MainTimeline::frame1559:18]
    at flash.display::MovieClip/gotoAndPlay()
    at workingonhellscene_fla::MainTimeline/fl_ClickToGoToScene_3()[workingonhellscene_fla.MainTimeline::frame6188:22]

     

    frame1559:18 is button1.addEventListener(MouseEvent.CLICK, clickHandler1);

    workingonhellscene_fla::MainTimeline/fl_ClickToGoToScene_3() is my credit scene button that goes back to frame 1559.

    and frame 6188 is non-existent, my friends dont up to that much even!

     

    I'm sorry to be a pain man, but I really dont understand what I'm doing wrong.

    Translate