I have built an app that calls up random movie clips from a bank of 24. In the beginning it works great with no errors, etc. After a few minutes, I get that dreaded 1009 error. I have searched all of the Error 1009 entries and cannot find a relevant solution.
Here is my code and the error message. The debug function shows that the error is in last line of code. Thanks for any and all help!!
var totalb:uint = 24;
this["Music_mcb" + Math.round(1 + Math.random() * (23))].gotoAndPlay(2);
TypeError: Error #1009: Cannot access a property or method of a null object reference.
Please make sure that each Movie Clip instance you're trying to access with this code is in the correct frame when it's called.
Because maybe you're trying to call "Music_mcb12", for example, from frame 10, but the instance is actually in frame 12.
Thank you for the reply!!
All 24 of the movie clips are loaded onto frame 1 and remain for the entire timeline (1050 frames).
The error does not happen all the time, so I have added a loop to the application to give it plenty of time to misbehave. And the misbehaviour always happens in this frame (256) which is the first call from this bank of movieclips. I am thinking it may be something with one particular movieclip that throws an error when it is called.
I have checked instance spelling, caps, etc. But I am going to check all of that again as soon as I click "post." Is there something else that could be wrong with a movie clip that would cause this error?
I did find an error in one of my movieclip instance names. I had misnumbered so that the math that should call that movieclip could not find it because of my error in numbering. I will leave the app running tonight to be sure it does not throw an error after that correction.
Thank you so much!!
Excellent! I'm glad you managed to solve it!
The app was still running as it should after 12 hours. I hereby pronounce that gremlin "dead."
Thanks for the guidance, JC.