Home News What To Do With ActionScript 3 Error 1009?

What To Do With ActionScript 3 Error 1009?

54
0

 

You may encounter an ActionScript 3 error code 1009. There are several steps you can take to resolve this issue. We will explain this to you shortly.

Error 1009 means that you tried to do something with a variable that you think was relevant, but it didn’t. Flash doesn’t like this. You won’t like it either; Imagine a glass that you thought was filled with your favorite drink, but was actually empty.

 

 

Problems creating a website in Animate CC using ActionScript3.

Any help is appreciated.

I usually try to get the service, contact, home buttons to work when I click them.

import flash.events.MouseEvent;

stop ();

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

gohome function (event: MouseEvent): void {

gotoAndStop (1);

}

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

actionscript 3 error 1009

Goabout Function (event: MouseEvent): void {

gotoAndStop (2);

}

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

Go service function (event: MouseEvent): void {

gotoAndStop (3);

}

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

gocontact function (event: MouseEvent): void {

gotoAndStop (4);

}

Test run and received after debugging are allowed

TypeError: error # 1009: Unable to access property or method of an empty object reference.

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

Frame 1, line 3

Error 1009 means that one of the objects in your target code is out of range. This may mean that the object …

– declared but not created

– has no instance name (or the instance name is misspelled)

– does not exist in the frame this code is trying to reach

– animates in place, but does not get the instance names at every matching keyframe

is one of two or more consecutive keyframes of the same object that were not named in previous frames.

Solution 1 (don’t Do It, Just Show What Is Possible)

The easiest way to solve this problem is to simply add a component to the scene before setting the title.

var myComp: MyComp = new MyComp ();addChild (myComp);myComp.button.label = "Button Label";

As you can see, we just swapped lines 2 and 3. This is definitely not a good practice. While it is running, this means that you need to review your component before making any changes to it. This is rather ineffective because Flash Player is requiredo update the component a second time.

Answers To: TypeError: Error # 1009: Cannot Access Nullable Property Or Method


  • Previous topic
  • Flash and ActionScript
  • Next topic –
  • Page 1 of 1