views:

642

answers:

1

I have some fairly large movieclips in the library which need to be dynamically loaded at runtime. I don't want to export them all in frame 1, because that would slow down initial loading of the movie.

I tried putting an instance of each of these clips later in the timeline where they wouldn't normally be encountered. When I then tried to load one from the library dynamically, I was able to successfully get an instance of the movieclip, but its currentFrame property was 0 and I couldn't see anything on the stage. As soon as I enabled "Export in frame 1", it worked properly.

Does this old trick of putting an instance on the timeline somewhere no longer work in AS3?

+2  A: 

I have had similar issues with large library assets and to solve my issue I would always just put the assets into separate swf's and load the external swf file when I needed it.

Check out the Loader class 'content' property - http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html#content

The only downfall to this is managing the assets in separate files.

I hope this helps.

Matt Fisher
The other problem with this approach is the wait time while the external file loads.
elmonty
True, but the data needs to load either way and loading it all at once isn't any faster.
Matt Fisher
I was hoping that it could load in the background if I put it later on the timeline of the main movie.
elmonty
If you are just trying to load a single image - just use the loader class and bring in the raw image.http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html
Matt Fisher