Tag Archive for 'Event.ADDED_TO_STAGE'

Is now a good time to start using Event.ADDED_TO_STAGE vs. your class constructor for initialaztion?

I have always had a habit of doing all my init stuff in the class constructor as do most other people. But today I found a GOTCHA in Flash CS4 when publishing an AIR file.  I was trying to use a ProgressBar and set it’s value manually. I could not see the bar change it’s value even though there was no errors. Nothing I did made it work. This was a problem since there was no errors letting me know that there was a problem, the progress bar just did not work and that’s all I had to go off of.  Later I tried to place my document class code on the timeline which made the progress bar work,  leaving me even more confused and fustrated as to the problem.

In the End I found this had to do with the document class trying to set properties of the ProgressBar before the document class had a chance to be added to the stage.

Aside from my story, this may or may not ever be a problem for you , but it begs the question should this be a standered and would you follow it?