This content has been marked as final. Show 2 replies
"Rabaab_m" <firstname.lastname@example.org> wrote in message news:email@example.com...
> However, each time a new Movieclip has to load, there is a lag... if it is
> playing off a CD-ROM, the CD starts spinning again, if it is on the local hard
> drive the lag is less but still noticeable.
> So how can I avoid this? Do I need to make a preloader for this? Or can I
> put some ActionScript in the first movie which will preload all the subsequent
> SWFs without needing to make a preloader/progress bar?
> And please in any answers, be as obtuse as possible... I'm very, very new with
Under those conditions you can load everything right in the beginning and just wait for everything to load up. That puts all the
loading lag up front in one lump without spreading the lag through the whole presentation. Since it's loading locally you don't
have to worry about the wait.
Since you would be loading everything, you don't want everything to show, just parts of it. To do that you can either set
visibility to off for movieclips that you load into or position out of view or the option that I like.. Make all the external swfs
have a blank frame 1 and a stop command. When you want to hide them, move them to frame 1. When you want to show them, move them
to frame 2 and play. Each swf can have it's own preloader that does nothing more than set a flag variable to notify the main swf
that it is loaded.
Details if you need it.
There is no way to do a preloader – in the regular sense – when playing from a local system. The Flash player just loads the whole thing in "one chunk" so getBytesLoaded will go from nothing to total in one step and the MovieClipLoader class's onLoadProgress will not be called.
tralfaz's solution is a likely candidate. If the files are really huge it could still cause some memory/playback problems. Actually the upfront load-up can cause a problem. I've had rare occurrences where – on mostly slower, older machines – the projector would "stall" part way through the first frame. Adding 5 to 10 blank frames at the beginning seemed to help. Just keep that in mind.
Also, depending upon the exact needs, you could do something like have some code that checks an XML file or some such every minutes or what have you. That would keep the CD or HD spinning.
PS: You might want to look up "obtuse" in a dictionary! (I guess one meaning could mean what you meant, but I think that really only applies to geometry.)