I’m reffering to the tutorial on this site, found here.
First let me say excelent tutorail. Well written, structured, and very helpful.
Second, let me admit that I am very new at flash, doing it mostly as a hobby to create a cool website for my wife, and I started about a week ago. With that said, I have gone through almost all the tutorials included with flash (however non-helpful they are), and looked at many helpful things on this site and other flash sites. Still, I’m just starting to get my feet wet.
My question is this: Would it be possible to somehow use the animation from the midpoint to the end of the movie to start pre-loading the next movie? Furthermore, would it be possible to do it in such a way that the animation from the midpiont to the end of the current movie took as long as it does for the next movie to load? Basically what this would do is create a ‘stealth’ preloader, where the user wouldn’t even know that they are waiting for something to load, because they are busy watching a cool transition animation.
The way I understand the preloaders, I’m skeptical if this is possible, but if it is, I’d love for someone to explain how. This is how I understand preloaders now:
When you load a swf, it starts playing as soon as it has loaded the first frame. Putting a preloader in basically removes most of the graphical data from the first few frames so that they load very quickly, and then inserts code to wait until the whole movie has loaded to continue playing the movie.
My idea would be to use MovieClipLoader.loadClip() to start loading the new clip while telling the current clip to go to a particular frame corresponding to the percentage of the new movie that has been downloaded.
Basically, clicking on a navigation button would initiate a MovieClipLoader.loadClip command and then GotoandStop at specific frames in the current movie, based on how much of the next movie has been downloaded, and repeat until the new clip is loaded. My very sorry attempt at such a script is below, but I’m sure it’s wrong and flawwed in so many ways:
var my_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
function mclListener.onLoadProgress(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number){
_root.container.gotoAndStop(midframe+(_root.currMovie.totalframes-midrame)*(bytesLoaded/bytesTotal));
}
function mclListener.onLoadComplete(target_mc:MovieClip){
currentMovie = traget_mc;
}
on (release) {
if (_root.currMovie == undefined) {
_root.newMovie = “main”;
container.loadMovie(“main.swf”);
} else if (_root.currMovie != “main”) {
if (container._currentframe >= container.midframe) {
_root.newMovie = “main”;
my_mcl.loadClip(_root.newMovie+".swf", _root.container);
}
}
}
Any thoughts or corrections to my sorry attempt?