bryce
12-13-2006, 07:23 PM
So the site i'm working on is an online portfolio and is about 19mb. Apart from resizing and lowering quality (to reduce file size and thus loading time) I'm looking for a way to preload the site a scene at a time as it is navigated through, as opposed to preloading the entire site at once which takes way too long. Currently the code I'm using to preload the enitre site is:
preloader.preloader_bar._xscale = 0;
preloader._visible = false;
stop();
function startMovie() {
if ((getBytesLoaded() == getBytesTotal())) {
preloader._visible = false;
gotoAndPlay("start");
} else {
startLoad(this);
}
}
assessLoad = function (Clip, endPreLoad) {
var kbLoaded:Number = Clip.getBytesLoaded()/1024;
var kbTotal:Number = Clip.getBytesTotal()/1024;
var percent:Number = Math.floor(kbLoaded/kbTotal*100);
preloader.preloader_bar._xscale = percent;
preloader.pct_loaded.htmlText = percent+"%";
if ((kbLoaded/kbTotal == 1) && kbLoaded>1) {
endPreLoad();
}
}
endPreload = function () {
clearInterval(preload);
gotoAndPlay("start");
}
function startLoad(Clip) {
preload = setInterval(assessLoad, 100, Clip, endPreload);
preloader._visible = true;
preloader.preloader_bar._xscale = 0;
}
startMovie();
Is there a way I can get this to only load one scene instead of the entire site? Also, I have read in various places that scenes are to be avoided, so If I didn't break each section of the site into scenes, how then could I go about preloading the different sections as they are selected, as opposed to having the entire movie clip preload?
preloader.preloader_bar._xscale = 0;
preloader._visible = false;
stop();
function startMovie() {
if ((getBytesLoaded() == getBytesTotal())) {
preloader._visible = false;
gotoAndPlay("start");
} else {
startLoad(this);
}
}
assessLoad = function (Clip, endPreLoad) {
var kbLoaded:Number = Clip.getBytesLoaded()/1024;
var kbTotal:Number = Clip.getBytesTotal()/1024;
var percent:Number = Math.floor(kbLoaded/kbTotal*100);
preloader.preloader_bar._xscale = percent;
preloader.pct_loaded.htmlText = percent+"%";
if ((kbLoaded/kbTotal == 1) && kbLoaded>1) {
endPreLoad();
}
}
endPreload = function () {
clearInterval(preload);
gotoAndPlay("start");
}
function startLoad(Clip) {
preload = setInterval(assessLoad, 100, Clip, endPreload);
preloader._visible = true;
preloader.preloader_bar._xscale = 0;
}
startMovie();
Is there a way I can get this to only load one scene instead of the entire site? Also, I have read in various places that scenes are to be avoided, so If I didn't break each section of the site into scenes, how then could I go about preloading the different sections as they are selected, as opposed to having the entire movie clip preload?