TypeError: Error #1009: Cannot access a property or method of a null object reference
ActionScript 3 Error #1009 is an AS3 that you can get for many anecdotal reasons. This error basically means that you are trying to reference something that isn’t there yet. That something can be a variable, data from the server, or even a movieClip or other display instance. So if you try and make a call to something and are getting this error simply look at what you are trying to reference and ask yourself is it there yet.
Don’t bang your head against the wall any longer. Here I explain one of the most un-obvious ways to get this error.
One reason that you will get AS3 Error #1009 is because you are trying to access a movieClip that isn’t instantiated yet. For example you try and reference a movieClip named loader_mc that is inside another movieClip. you are referencing it from a class that you created. Each time you run the test the movie you get the Run-Time Error #1009. You look inside your movieClip and see that the loader_mc is right where you want it. It is on frame 10 inside your animated moveiClip. That is when it dawns on you that the call to loader_mc happens when it is instantiated. Simply, put loader_mc on frame 1 and change it’s alpha to 0 and then the movieClip will be instantiated when the call from your custom class is made.
Another reason for this error is simply incorrect targeting. If you target parent.bob and the correct reference is parent.parent.bob then you will get this error as well.
Fix 1 :
Make sure the the reference is instantiated before it is called. This means that the script is run after the object is loaded or the frame in the animation has been reached etc…
Fix 2 :
Check your targeting
Thanks and Happy Flashing