Multiple Preloaders on One Page

Hi ya all, my first night here, I’m trying to place three individual pre-loaders on my home page (url: http://ispice.us). I want the page divvied into three sections; three different movie clips; three different pre-loaders. The page is 760x480 pixels, I want the bottom MC (760x74 pxl area) to load first, so visitors can check out the info in it while the Main MC loads. i want the top Navigation (760x48) to load second; and, the Main MC; which has the most frames; to load last. If you visit the site you will not see any preloader at all, simply because I’ve only been able to get one placed correctly, and working, I have not bothered re-publishing the page because I want THREE pre-loaders on the page.
The code I’ve used to place my one pre-loader is this:
onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)100)).25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndStop(2);
}
}

It works fine but, as I said, I want three on the page, one for each of the three sections. I’ve tried and tried, but, have not been successful at figuring out how to get three individual pre-loaders to work; when the page is loaded.

I started this early this afternoon; thought it would be a quick add on to my project but; as often is; it’s taking much longer than I anticipated. My eyes have begun to hurt, again, from the strain. Please, oh please, assist me if you can! I hope you wise ones can solve this and show how good you really are!

PS. Kirupa is the best. I’ve learned so much from the site.

in the first frame
3 textfields, variable names t1,t2,t3

stop();
for (var j =1; j<4; j++) {
clip = createEmptyMovieClip(“paper”+j, j);
//position where you want
clip._x = 100j;
}
assessLoad = function (clip, myvar) {
clip.kbLoaded = Math.floor(clip.getBytesLoaded()/1024);
clip.kbTotal = Math.floor(clip.getBytesTotal()/1024);
clip.percent = clip.kbLoaded/clip.kbTotal;
//if you want animation/loading bar etc reference here
//eg _root[“loadingbar”+myvar]._width blah blah…
_root[“t”+myvar] = Math.floor(clip.percent
100)+“%”;
if ((clip.kbLoaded == clip.kbTotal) && clip.kbTotal>1) {
_root[“t”+myvar] = “loaded”;
clearInterval(_root[“myInterval”+myvar]);
}
};
loadMovie(“pic1.jpg”, paper1);
loadMovie(“pic2.jpg”, paper2);
loadMovie(“pic3.jpg”, paper3);
myInterval1 = setInterval(assessload, 20, paper1, 1);
myInterval2 = setInterval(assessload, 20, paper2, 2);
myInterval3 = setInterval(assessload, 20, paper3, 3);

http://www.gifsrus.com/testfile/fadeinout/multiloaderprel.swf

You could instead just make a preloader in the first frame of each movie

K this question is semi related… i just didnt want to create another thread and crown the forums…

anywayz ny question is:

How do i create muliple preloaders that occur at different parts of my movie…

reasoning:

I’m creating a game and some of my friends still run dialup so i know that even a game over 3mb will take them over 10 minutes to load…
My game will have levels and i thought it would be easier for my friends and people on slower connections to have the level load before it’s played.

I’m not exatly sure how to do this though… i know how to create a preload but this is somewhat different my friends.

any help

Is you movie divided up into several movies or just one big one.

its one big movie…

the first frame i have in the first scene is a preloader ( ready to take out if thats wat it takes)

the second frame is the start screen

thrid frame credits

and the forth frame i was gonna have a few mc’s for my game.

then i was thinking for each new level id put it on the first frame on a new scene

You really need to have a look at the bandwidth profile thing.But at the start I would do something like this
stop();
assessLoad = function (clip) {
var kbLoaded = Math.floor(clip.getBytesLoaded()/1024);
var kbTotal = Math.floor(clip.getBytesTotal()/1024);
percent = kbLoaded/kbTotal;
percent_txt.text = Math.floor(percent*100)+“%”;
if ((kbLoaded>=kbTotal/20) && kbTotal>1) {
clip.gotoAndStop(“startframe”);
}
if ((kbLoaded>=kbTotal/10) && kbTotal>1) {
clip.gotoAndStop(“credits”);
}
if ((kbLoaded>=kbTotal/5) && kbTotal>1) {
clip.gotoAndStop(“startGame”);
}
if ((kbLoaded>=kbTotal) && kbTotal>1) {
clearInterval(myInterval);
}
};
myInterval = setInterval(assessload, 50, this);

it really depends upon how you have made it and you`ll have to experiment with how much you have to preload in order to “stream”.

hmm…

is there an easier way… like make each level a different fla or something…

or maybe each one a different movie clip…

thats prob easier rite

onClipEvent (enterFrame) {
_root.loadMovie(“url of swf here”)
}

added that to an mc on frame 4.

this will load the first level and at the end of the first level ill create another so it keep adding on… i think thats a good idea eh.

also… question… for the place where i put the url of my swf… is that all i can do…

like does the swf im loading have to be on a swf file hosted on the internet or is there another way…

ALso if there is a better way to do this please say

hmmm, its not terribly difficult.
I asked if you were using one big file or several, if you are using several use

stop();
createEmptyMovieClip(“paper”, 1);
assessLoad = function (clip) {
var kbLoaded = Math.floor(clip.getBytesLoaded()/1024);
var kbTotal = Math.floor(clip.getBytesTotal()/1024);
percent = kbLoaded/kbTotal;
percent_txt.text = Math.floor(percent*100)+“%”;
if ((kbLoaded == kbTotal) && kbTotal>1) {
// do whatever
clearInterval(myInterval);
}
};

whenever you want to load something
loadMovie(“levelwhatever.swf”, “paper”);
myInterval = setInterval(assessload, 50, paper);

wat the paper stand for…

and is there a way to load everything if i am using one big file

its an empty movieclip
the way you suggested, you are loading it to _root. This would wipe everything else off.

I think the best thing for you to do would be for the user to pick their level straight away(seperate .swf) so that this can be instantly loading, then you can show the credits etc while this is happening.we have all become obsessed with preloading but if you can get away with only loading say 30% of the movie before the user starts to play and it still runs smoothly(continues loading while playing) then it is much better.

ya but the fun of the game is not knowing exactly wats gonna happen in the level or the storyline to it… example if they choose a desert level and lets say there was some sorta mummy …( insert interesting storline )

the people wouldnt know whats going on and that can really make the user feel like the game is a no smoe game…

anywayz if there is a way to use multiple preloading and still only have 1 fla file i would like to know…

ex - each preloader preloads a scene?

if not ill use ur way but preferably id like 2 know this way so its easier on the user

possibly the load frame function?

meck, I’am also looking into doing exactly what you want to do. If I find out how I will post in kirupa. But if you foind out how first please message me back. thanks.

np…

ill post it too

You should not use scenes for this sort of thing, you will only run into problems.The way outlined above is what i`d try.
When you use a preloader, all you are doing is stopping the timeline and playing some animation while more frames (external movies etc) load so if you are clever about it, you will not have to load 100% before starting to play.
Having said that Have a look at this
http://www.gifsrus.com/testfile/hierachyprel8.swf (ignore the random text- this whole thing was just quickly made to test a preloader idea.)
This is 6 movies which just load in order but if you click a button in the meantime( maybe your user makes a different choice) then the order changes and that movie becomes priority.
This is just using the same code as above.

so i add this to everyone of my bars and it shall make it a preloader?

stop();
createEmptyMovieClip(“paper”, 1);
assessLoad = function (clip) {
var kbLoaded = Math.floor(clip.getBytesLoaded()/1024);
var kbTotal = Math.floor(clip.getBytesTotal()/1024);
percent = kbLoaded/kbTotal;
percent_txt.text = Math.floor(percent*100)+"%";
if ((kbLoaded == kbTotal) && kbTotal>1) {
// do whatever
clearInterval(myInterval);
}
};

i dun really get tat

maybe post ur fla?

no, its just a function which you would have on the timeline and call each time you use loadMovie.
Its pointless me uploading the .fla.
If you want to upload a basic draft of your game, i`ll see if i can break it up for you.