PDA

View Full Version : Loading multiple .swf's in background. Logic ?


mcmcom
10-18-2004, 11:16 PM
Hi all,

got a new one for ya:

I have a top level .swf that loads up to 5 .swf files into it. It uses a combobox to select them. One of the 5 is set to a default (the one that loads first). This loads and displays in it and you can read it, then when your done, go pick another document. My boss wants the other docs to start loading in the background before the user calls them (therefore if they read the whole first doc, hopefully all the others will be loaded by the time they want to select them) So I need some help on my algorithm to do this.

Heres what i got so far: Tell me if im way off.

1. The first document loads by itself, to ensure it loads as quickly as possible
I should probably wait until its 100% loaded before i start any background
loading... (right?)

2. Once its %100 (what will i use to test that, onEnterFrame? or a listener
perhaps?) I should create an empty clip off the stage and at a level below
my viewable area and start loading the next document in the array.

3. Somehow must keep track of that one loading and when its 100% then I
move to the next item in the array, (and so on and so forth)

This sounds pretty straight forward to me but I wanted to ask this. If I create an empty clip, and load an external .swf to it. Then Remove it (so I can load the next) Will that nullify my preloading? Or will the .swf be cached locally by now? Do I have to create a new holder Clip for EACH .swf and keep them loaded (but not visible) in the background? Or can i just load them then blow them away and call them when i need them?

THANKS FOR THE INFO

also if anyone knows to create a listener for completed or loaded Bytes, an example would be appreciated.

Thanks
McM

Gibberish
10-18-2004, 11:27 PM
I have a movie player i built and i did the same thing. While one movie is playing it's next movie isl loading into a mc off stage, once that one is done a third loads in another movie off stage.

Once the first movie is done it loads the 2nd offstage mc into it's place and moves the first mc off stage. If the 2nd mc isnt loaded it still moves it inplace of the 1st mc you just see the preloader still going though.

mcmcom
10-18-2004, 11:37 PM
what about my question regarding destroying the backgrounded loaded clip?
I load all my .swf's into a scrollPane, and the combobox gets XML data and ALWAYS points to an external .swf. If I preload these buggers in the background and then destroy them once loaded, will i have ever preloaded them? LOL You know what i mean, will they be in LOCAL memory? Or is it pointless. Because when it comes down to it. The Combobox is what calls the new doc and I dont want to change the dataBindings for the combobox because then i need a whole set of methods to load the hidden .swf rather than the same file externally.

Users with FlashPlayer can set their Local downlaod limits on their machines. Some people only have it set to 10k local space for caching. Would it even matter if I was doing this and someone was looking at it with only 10K space reserved on their machine. each one of my docs is easily over 1Meg. So should i even bother?

mcmcom
10-19-2004, 06:57 PM
anyone know the answer? thanks

Gibberish
10-19-2004, 07:23 PM
I wouldn't bother. You can't depend on the save space or them not deleting their temp files everyday.

Just make it preload, if it's saved then it preloads all the faster. Don't delete the mc while they are still viewing the page, just move it off stage and have it stop playing if there are animations.

mcmcom
10-20-2004, 06:01 PM
Ok, that makes sense, except for this. My combobox (that selects the docs) Always points to external .swfs (located SOMEWHERE on a domain on the net) If I preload them in the bkg and then the user selects them they are essentially selecting the External .swf (not the one loaded in the bkg) so does this speed it up? Or not?

thanks

Gibberish
10-20-2004, 09:22 PM
those external swfs are loaded into a holder though? So you do have preload, unload and placement control over them so the same logic would apply, unless I am missing something that you are trying to do?

mcmcom
10-21-2004, 07:25 PM
no that make sense. I just dont think its feasable to load these items in the background. What im loading into a scrollPane is a flash movie thats kinda like a book. Its not animated just pages and pages of text and graphics. So users read it (kinda like a pdf) The loaded movie "streams" its way into the scrollPane and the first pages show up before the entire doc's loaded. Which is super cool because that gives the user something to read while the doc is finishing up its load routines. We were thinking about loading a few docs in the background but they load real quick as it is (thank you z lib compression) and im not going to bother with it. Full text search is a priority.

Thanks Gibberish for your help