PDA

View Full Version : Preload a Library item?


BosBill
07-13-2009, 03:52 PM
I understand how to preload a loading SWF, and I understand how to preload from one frame then go to the next, so please don't post about doing those.

My question is can you preload a symbol from the library and keep all code and content in one frame? I've searched everywhere and can't seem to find any tutorials to do this.

TomMalufe
07-13-2009, 05:08 PM
Preload a symbol from the library...? I think those are automatically preloaded with your SWF so I don't really understand the problem.

BosBill
07-17-2009, 03:45 AM
I didn't realize this. I was under the impression that only symbols and images on the stage were part of the original SWF size, but you're saying that everything in the library is? Does it matter if you "Export for Actionscript" or do they all load regardless?

juskin
07-17-2009, 05:03 AM
a symbol is NOT preloaded or included in a swf just because it is in the library, if you have the linkage set and are defining the symbol as a class, then you can create an instance of that object on one frame, use the addChild method and turn either visability to false or alpha to 0, I think you would want to use the alpha to 0 method becuase when you set visibility to false it garbage collects that instance and there for its not loaded anymore...

snickelfritz
07-17-2009, 05:34 AM
Library symbols exported for actionscript, are included in the compiled SWF, even if they are never added to the stage.
Check the file size of the complied SWF in the bandwidth profiler window; exported symbols are definitely in there.

henke37
07-17-2009, 08:02 PM
Hidden instances being garbage collected? That I refuse to belive.
It is very simple, symbols and classes are exported on the first frame that they are used. If they are not used, they can be forced to be exported so that actionscript will be able to use it at runtime.

snickelfritz
07-18-2009, 12:00 AM
I understand how to preload a loading SWF, and I understand how to preload from one frame then go to the next, so please don't post about doing those.

My question is can you preload a symbol from the library and keep all code and content in one frame? I've searched everywhere and can't seem to find any tutorials to do this.

In the Linkage panel, give the symbol a class name; it will be included in the SWF, and immediately available on request.