Flash, you fickle beast

TypeError: Error #1009: Cannot access a property or method of a null object reference
at Map_fla::MainTimeline/frame1()

As anyone who has worked with Flash is surely aware, the program and ActionScript can drive you insane with its seemingly fickle error codes and output messages.

For me the output errors are the most frustrating, because unlike the ActionScript error messages they don’t point you to a specific problem in a line of code. Sometimes the output errors will completely disable your functionality, and other times they seem to have no effect as they constantly flash across the Actions screen.

The errors at first seemed to take National Security level deciphering, but I am slowly beginning to comprehend the ways of this inconstant creature.

The null error (seen above) was my first conquest, as it threatened to disable my beginning attempts at a more advanced Flash project. I was starting to embed movieclips within movieclips to get more detailed and advanced animation. My buttons were performing several functions at once, and the timelines were filled with tweens and layers.

Everything seemed to be moving along great until Error #1009 struck. Through the use of Google searches and some very helpful resources (which I will discuss in a subsequent post), I discovered that Flash really hates blank key frames in the beginning of timelines. If ActionScript for control of a timeline (gotoAndPlay, etc.) doesn’t see an object in Frame 1, it doesn’t seem to see it at all, resulting in a null error.

Now why is this and how do you fix it? These are questions I still have. The solution I found was to place the object in frame one (even if all the frames between one and 167, where the object starts to play, were blank). I would then use Alpha to make the object invisible, or I would move it off the stage. With a mask over the project as a whole, things off the stage wouldn’t matter.

The downsides to my solution are that it takes a lot of extra time. If you miss just one layer of one timeline you will still get the error, and it seems to create a lot of unnecessary and wasteful “invisible” objects that clutter up my stage. If anyone has a better solution, I am all ears!

Advertisements

2 thoughts on “Flash, you fickle beast

  1. SinCe this post I’ve found a better solution, don’t put action script in the object until the frame where the mc or button first appears.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s