Hi all
Flash CS3 (coding in AS 2) - mac.
I have got my preloaders working (finally!) on my site. There are 4 “pages” where if the user clicks a button they are taken to that page i.e. the timelines moves to a frame where an external swf is loaded into a empty MC, and it has the preloader loading it in using MovieClipLoader and all that malarky. What I have noticed is that even though when all the movies have been loaded (i.e. they should be cached) the preloader appears for a very small amount of time - like it is flickering on and off just once - as if it is just doing the whole preloading routine and getting to 100% straight away so it disappears. So i guess it is doing what I am asking it to do in this code (for one movie):
preloaderMC2._visible = false;
var aboutLoader:MovieClipLoader = new MovieClipLoader();
var aboutLoadListener:Object = new Object();
aboutLoadListener.onLoadStart = function() {
about_movie_holder.stop();
};
aboutLoadListener.onLoadProgress = function(target:MovieClip, loadedBytes:Number, totalBytes:Number) {
var preloaded:Number = Math.floor(loadedBytes / totalBytes * 100);
preloaderMC2._visible = true;
preloaderMC2.loadText.text = preloaded.toString() + "%";
preloaderMC2.loadBar._yscale = preloaded;
};
aboutLoadListener.onLoadInit = function() {
preloaderMC2._visible = false;
about_movie_holder.play();
};
/**** register listener object with MovieClipLoader object ****/
aboutLoader.addListener(aboutLoadListener);
Is there any way to make it work out if the bytes have been loaded and if so, just make the preloader invisible? I have tried using:
if (_root.about_movie_holder.getBytesLoaded() >= _root.about_movie_holder.getBytesTotal()) {
preloaderMC2._visible = false;
}
within the MovieClipLoader code above and also within the code on the frame where the user would be taken to for the About page (in this case). On this frame, the visibility of a number of things are toggled on or off as necessary and the movie is loaded using loadClip. Neither has worked.
I hope that makes sense - its quite brief I know so please ask for more info if needed - but basically I would like to not have this preloader flicker happening. It just appears and disappears once, really quickly. It doesnt happen for all the pages, and sometimes after, lets say, it doesnt happen for the about page, if you keep clicking on all the pages, it would happen again on the About page. In other words its pretty random.
Thanks in advance
Theo