Click to See Complete Forum and Search --> : Preloading a SWF containing embedded video


Chris Jacks
01-22-2009, 08:19 AM
Hi all,

I have a preloader that preloads a separate/external SWF...
Original FLA's can downloaded here:
The Preloader = introloader.fla (http://www.artboxgraphics.com.au/test/rawfiles/introloader.fla)
The Movie = intro.fla (http://www.artboxgraphics.com.au/test/rawfiles/intro.fla)

The problem is, the preloader (introloader.swf) seems to be preloading all the elements of the movie (intro.swf) except for the emedded video clip that was imported from a Quicktime Movie (mov) file, and then playing the movie before the embedded clip has finished loading.
Click here to see an example. (http://www.artboxgraphics.com.au/test/)

Does anyone know how I can make the preloader preload the entire intro.swf movie (including the embedded .mov file), before it starts playing?

Any help is very much appreciated!


Cheers

Chris

Eye for Video
01-22-2009, 10:07 AM
Most preloaders I've used are created using the first 5 or 10 frames of the main movie, not as a seperate loader, so that may be a problem.
You are correct, it is starting to download the main movie immediately. Seems like the offending line is
container.loadMovie("intro.swf");
from your preloader, it's loading the movie before the preloader works through all the percentages. To test that theory, comment out all the rest of the code. Main movie loads and plays.
So it's loading and playing the main movie while the preloader is working away telling you how much has been downloaded.
If you put your "container" in frame 10, preloader in the first 10 frames, then "this" will be the entire clip (preloader and movie). Then just measure the percent downloaded of "this". At 100%, go to frame 10 and play the movie. something like this:
this.onEnterFrame = function():Void {
var loadedData:Number = this.getBytesLoaded();
var allData:Number = this.getBytesTotal();
var percent:Number = Math.round(loadedData/allData*100);
if (loadedData>=allData) {
gotoAndPlay(10);
delete this.onEnterFrame;
}
};
adapt for your loader bar, but maybe you get the idea.
Oh yeah, don't forget to put a "stop();" in the last frame before the "container".
Best wishes,
Eye for Video
www.cidigitalmedia.com

Chris Jacks
01-24-2009, 01:54 AM
Thanks EFV! You're a genius! That works a treat!

Cheers mate,

Chris