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

Explorer ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

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:

screenshot for adobe.pngthe cooodes.png

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.

Views

242

Likes

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

Explorer , Jun 14, 2021 Jun 14, 2021
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!

Likes

Translate

Translate
Explorer ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

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

Likes

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
Adobe Community Professional ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

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.

Likes

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
Explorer ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

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.

Likes

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
Explorer ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

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!

Likes

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
Adobe Community Professional ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

LATEST

you're welcome.

 

(for others the button needed to exist when the code executed, frame 1559.  if the button was on stage on frame 1560, that would cause the problem seen by the op.)

Likes

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