This content has been marked as final. Show 16 replies
anybody knows how can I postpone loading mcs from library till they are actually needed or if this is even possible?
you can't postpone loading movieclips from the library. they will be loaded when the frame with which they're exported loads and trying to time the loading of a particular frame is an exercise in futility.
you can time the loading using the idea in your first post. you only different different target movieclips for those external assets that will be displayed simultaneously .
hm, how would you do it then? Exporting each MC for a different frame and then make the playhead to slide along these in order to appear on the stage?
why bother what? realizing this idea?
What you describe sounds more like you just want to load external items on demand (i.e. multiple swfs) rather than have them all in the same swf. That can be done easiest using the MovieClipLoader class. You could cycle through two target clips for your transitions. One is displaying while the other is in the process of loading. When its loaded you slide it in and start another load in the other one.
do you mean this? That would anyway mean I would have to have more of these actual "loaders" as well as the objects, right? Or can I just put this all into a FOR loop? The initial idea was that I would all of them to start loading simultaneously and they would be basically appearing in the stage on after another since their size may vary.
You need a new movieclip target for each new swf you're loading if you're keeping the others and not removing them or loading new content into them.
I tend to create new MovieClipLoaders for each new load, just out of habit and not all habits are good. Perhaps that's not necessary, you should be able to reuse it I think for the next one after onLoadInit has fired.
You are limited to the number of simultaneous loads from the same domain by the browser. I believe this is 2 connections per domain for IE and possibly firefox as well. Don't know about other browsers. So more than that gets queued by the browser I think.
So you could set them up on a for loop, but they might not load in the same order you requested them (smaller files would normally load quicker for example).
I would tend to load them in a serial fashion with the onLoadInit handler from the previous load triggering the next one.
Or you could read these articles by David Stiller for some other ideas:
Hm, I was wanting to have like MCs rather than 50 different SWFs to load you see? Anyway, you brought a good idea up so thanks for that and I'll get back when I test it
why bother = why bother exporting for different frames.
it makes more sense to load external swfs, as your now discussing, because that's the only way to accurately control when assets are loaded.
kglad: oh now I see - I was struggling to understand what you guys were talking about earlier, maybe because I've only ever used different export frames for assets to make it lighter at the front for a preloader. I agree with you I don't think I'd want to try managing it that way either. You lose flexibility even if you could make it work. Loading in external assets is more flexible because you can also define them externally in xml etc.
Hm, ok, ...considering I would be loading something like an image catalogue or so where the individual images would be sliding on to the stage, I just didn't want to have like 50+ loaders or MCloaderClasses...
so the conclusion is that I will make maximum of two loaders/holders (since more loading at once is not allowed by browser) and then put these into a for loop to load the content from external SWFs ....so the only pain will be putting each "sheet" into it's own SWF.
You probably wouldn't use a for loop to do that because its only two to start with, basically each MCloader can 'loop' to the next load when its finished its current one. You could wait until the onLoadInit handler fired to do that. So onLoadInit displays your latest load and sets in motion the next one.
Out of curiosity, what's in a 'sheet' ? Does each sheet have its own specific activity - animations etc that is completely different from the others.
If not, could you define the sheets in xml, and have them constructed according to the contents of the xml (text,images,layout etc), or are they wildly different?
hm, I think I would need to use some kind of combination of a loop and an array then.
Yes, when you rollover the sheet, the animation is the same but after clicking on it a video comes up, which is different according to the sheet again.
You could push each loaded clip into an array of loaded clips if you're keeping them in memory and not removing them after they've been displayed.
But the basic premise with the event driven approach is to use a counting variable, which is incremented each time a onLoadInit happens and just quit the loading cycle once you reach the total number of clips. I think cbeech/clbeech gave an example post here recently about this.
If the loaded clips themselves load other content e.g. videos etc it could get a bit complicated.
Re your other comment.
If pretty much everything else is the same, you could just use a single xml file to define the differences between the 'sheets' then, which would include the external flvs to load. So you would have one swf which 'renders' the sheet based on the xml definition for each sheet and handles the loading of the video. [Based on your description this is the approach I would use.]
XML can be structured to suit whatever your needs are...e.g. something like:
<title>Name of this sheet to appear in a textfield</title>
<description>If required, more detailed info to appear below the video</description>
[repeated as many times as needed with different data inside for each sheet]
If you don't know how to do this and it seems logical as an option, then you could check out some xml video playlist tutorials. It can take a while to get your head around accessing the xml data from inside flash... but it does fall into place eventually.
Yes, I have it done this way apart from the loading part...
cheers for help, will try something and get back again..