The weirdest error I ever encountered.

By Max_Morgon | Jan 14, 2009

actionscript3

I made a little particle engine for a project I’m working on, I have several particle sprites I wanna be able to use, and a single MovieClip that holds them all, each sprite in different frame, and I use this line to choose the sprite:

Code:

animRefMC.gotoAndStop(particleArray[j].sprite);

I get this error:

Code:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at particles::Particle_Manager/think()
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()


The weird thing is the code works perfectly, and this error only happens the first time I run the code after changing it.. lets say I changed the particleArray[j].sprite to something else, I run the code, I get the error, then I run it again without touching anything, and no error. Changed the frames position on the movieclip, running it, I get the error, running it again, no error.

What could be going on?

EDIT: Sometimes the error takes more times of re-running the code to disappear

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0