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

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

New Here ,
Aug 03, 2016 Aug 03, 2016

Having an issue with creating a website in Animate CC with ActionScript3.

Any help would be appreciated.

Basically I am trying to get buttons "home" "about" "services" "contact" to work when clicked.

import flash.events.MouseEvent;

stop();

header_mc.home_btn.addEventListener(MouseEvent.CLICK, gohome);

function gohome (event:MouseEvent):void{

  gotoAndStop(1);

}

header_mc.about_btn.addEventListener(MouseEvent.CLICK, goabout);

function goabout (event:MouseEvent):void{

  gotoAndStop(2);

}

header_mc.services_btn.addEventListener(MouseEvent.CLICK, goservices);

function goservices (event:MouseEvent):void{

  gotoAndStop(3);

}

header_mc.contact_btn.addEventListener(MouseEvent.CLICK, gocontact);

function gocontact (event:MouseEvent):void{

  gotoAndStop(4);

}

Ran test after permitting debugging and got

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

  at WORKINGwebsite_fla::MainTimeline/frame1()[WORKINGwebsite_fla.MainTimeline::frame1:3]

TOPICS
ActionScript
6.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

correct answers 1 Correct answer

LEGEND , Aug 03, 2016 Aug 03, 2016

Frame 1 line 3. 

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 pr

...
Translate
LEGEND ,
Aug 03, 2016 Aug 03, 2016
LATEST

Frame 1 line 3. 

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).

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