PDA

View Full Version : Preloader problem


CeciliaFlash
03-13-2008, 03:05 PM
Hello everyone,

This is my problem:
I created a SWF file (my main movie), and another SWF file that works as preloader of my main movie.
The problem I have is that the preloader progress bar starts and even if the main movie is not completely loaded starts playing. When is completely loaded, the progress bar dissapear as it has to do. But I´d like to see how my main movie starts when is completely loaded not before, and I don´t know what I´m doing wrong.
Thanks a lot and this is my preloader code:


var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();

myMCL.addListener(myListener);

myListener.onLoadProgress = function (target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
var loaded:Number = Math.round((bytesLoaded/bytesTotal) * 100);
progressBar.gotoAndStop(loaded);
}

myListener.onLoadInit = function (target_mc:MovieClip) {
progressBar._visible = false;
}
myListener.onLoadStart = function (target_mc:MovieClip) {
progressBar._visible = true;
}

myMCL.loadClip("mainMovie.swf","container");

madmac66
03-26-2008, 08:55 PM
I was about to post the very same question. Anybody have an answer? Did CeciliaFlash come up with a solution yet?

cheers
mm66

atomic
03-26-2008, 09:01 PM
When you don't have a hardcoded stop(); action in the to be loaded movie, and using a MCL to load it, you need to keep that loading movie from streaming in (playing if it can as the frames are loaded...), and to do so you would add a stop(); action on either or both of the onLoadStart & onloadProgress listeners/handlers, and only have it play on the onLoadInit handler, when the movie is fully loaded.

madmac66
03-26-2008, 09:16 PM
oh that appears to be a solution to a different problem I am having. will start a new thread

cheers
mm66

atomic
03-26-2008, 09:21 PM
Fine! ;)