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

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

New Here ,
Mar 24, 2014 Mar 24, 2014

The problem I’m having is when I run the program and click on button3 to bring me to page3, I get the error message:

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

                at Untitled_fla::MainTimeline/frame1()

                at flash.display::MovieClip/gotoAndStop()

                at Untitled_fla::MainTimeline/gohome1()

I’m just trying to use button3 to bring me to the third page which is page3. Everything else is working fine. Any help would be great!

import flash.events.MouseEvent;

import flash.net.URLRequest;

stop();

home1.addEventListener(MouseEvent.CLICK, gohome1);

function gohome1 (event:MouseEvent):void{

   gotoAndStop(1);

}

  1. bios.addEventListener(MouseEvent.CLICK, gobios);

function gobios (event:MouseEvent):void{

   gotoAndStop(2);

}

button3.addEventListener(MouseEvent.CLICK, goabout1);

function goabout1 (event:MouseEvent):void{

   gotoAndStop(3);

    

}

TOPICS
ActionScript
8.0K
Translate
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 ,
Mar 24, 2014 Mar 24, 2014

The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....

 

- is declared but not instantiated

- doesn't have an instance name (or the instance name is mispelled)

- does not exist in the frame where that code is trying to talk to it

- is animated into place but is not assigned instance names in every keyframe for it

- is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).

 

If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

Translate
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 ,
Mar 24, 2014 Mar 24, 2014

I looked over everything. The function works - it goes to the third page but when i click the Home button on the third page to go back to the first page, I get the error:

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

at Untitled_fla::MainTimeline/frame1()

at flash.display::MovieClip/gotoAndStop()

at Untitled_fla::MainTimeline/gohome1()

Basically, I can only go to the third page and back home once. Then the error message and the program no longer works.

Translate
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 ,
Mar 24, 2014 Mar 24, 2014

Chances are you missed naming a button.  If you follow the instruction at the end of my first response it will help you to pinpoint the line with the problem.

Translate
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 ,
Mar 24, 2014 Mar 24, 2014

This is what I got back.

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

at Untitled_fla::MainTimeline/frame1()[Untitled_fla.MainTimeline::frame1:8]

at flash.display::MovieClip/gotoAndStop()

at Untitled_fla::MainTimeline/gohome1()[Untitled_fla.MainTimeline::frame1:11]

Translate
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 ,
Mar 24, 2014 Mar 24, 2014

The error is indicating that whatever object your code is trying to target in line 8 does not exist when that lkine executes.  If it happens to be the line where bios is assigned an event listener, then for some reason it is failing.

In that line you show an " a. "   I am curious why that is there and if it could be the source of the problem

Translate
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 ,
Mar 24, 2014 Mar 24, 2014

Line 8: function gohome1 (event:MouseEvent):void{

Translate
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 ,
Aug 19, 2014 Aug 19, 2014

I think I have similar problem. Once I searched for the problem for 3 days and finally found it.

Mine was a Flash bug. Wasn't my script problem. There was one layer with one empty keyframe. If I put a vector graphics on it, the error was gone. If there was a or some MovieClips and there was no vector graphic - the error was there again.

Then I made a new layer and copy pasted all the objects from damaged layer to new.

NOTE: Don't copy the keyframes. Only copy the contents.

Now I have the same problem, but now my project is much more complicated. Many layers and code linked to the objects on the layers. I can't just delete layer and test if error is gone. I must to disable the scripts linked to them. That would be hard work......the same

Anyone had same problems?

Translate
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
Participant ,
Aug 20, 2014 Aug 20, 2014
LATEST

Yeah, with regard to that line: "a.  bios.addEventListener..."

What is the "a. " referring to?

Translate
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