Tuesday, February 16, 2010

More problems with the AS3 Loader Class

I've built an AS3 preloader so a Flash app can preload assets before starting. The app uses a number of Loaders to load about 15 swfs and when the LoaderEvent.INIT is fired it increments the index. When all of the assets have loaded, it starts the app and adds the contents of the Loaders to the display list:

myclip.addChild(MovieClip(myLoader.content);

However, when the app is run from the web occasionally it throws an error that a myLoader.content is null -- so it can't be added to the display list.

I assume that this means that a false INIT event is being fired -- or the player is not always seeing that the content is available to add.

In any event, I wound up setting a Timer that waits 2 seconds before adding the content to the display list. So far this seems to solve the problem for me -- but not the bug....

No comments: