Often I have this problem:
Within a script, I move to a keyframe where a movie clip exists. The movie clip is attached to an Actionscript 2.0 class. Once the movie clip exists, I want to be able to give it some initialization settings, but it seems they are not available until the next frame. For example, let’s say in a script I say:
gotoAndPlay(5);
the_object.init("test");
On frame 5, a movie clip the_class is placed (instance name “the_object”), and its associated class looks like this:
class the_class extends MovieClip{
public function init(str:String):Void{
trace("initializing with string "+str);
}
}
It appears that in my first script, you must WAIT until the next frame until the class code of an object you have just created becomes accessible. The trace() statement does not fire! How can I get around this problem without some annoying workaround where I have to display objects, then wait until the next frame before interacting with them? (I’m exporting as Flash 8 and using Actionscript 2.0)
Thanks!