PDA

View Full Version : help on preloader script


karlzoe2
12-05-2002, 11:38 PM
this script came from jesse's presentation on preloaders


total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
percent_done = int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
ifFrameLoaded ("Scene 1", 1) {
gotoAndPlay("Scene 1", 1);
}

when i was doing mine IN NORMAL so i can better understand where the actions came from etc... when i came to this action

bar.gotoAndStop(percent_done);


i typed it in ... HOWEVER in mine it identified bar as an object but in jesse's it was an expression

I searched and could not identified how to select the box to just type in expressions.


secondly this aspect of the code:

ifFrameLoaded ("Scene 1", 1) {

i had to type it in EXPERT MODE because i did not know where to find it under normal mode.



i know this is long and winded and i am adding to it but could someone shed some light on the above for me please

bigjimmo
12-09-2002, 11:36 AM
The code that I use for preloaders is :-

totalBytes = _root.getBytesTotal();
loadedBytes = _root.getBytesLoaded();
loadedPercent = (loadedBytes/totalBytes) * 100;

if (loadedPercent < 100) {
this.gotoAndPlay("preloader_start");
}
else{
_root.gotoAndPlay(5);
}

preloader_start is a label on the first frame.

I hope this helps

Jim

subquark
12-11-2002, 03:05 AM
I use a preloader in each loaded swf but would like one master loader (seems efficient).

How about a master preloader in the root swf. Would this make sense:

loadedBytes = _level4.getBytesLoaded();
totalBytes = _level4.getBytesTotal();
if (loadedBytes < totalBytes){
percentageOutput = int((loadedBytes / totalBytes) * 10;
loaderBar._xscale = percentageOutput;
_root.gotoAndPlay("preload_loop");
}
else{
_level4.gotoAndPlay("begin_movie");
}


Guess I'd need to put the loaderBar in an mc that I could make visible? I'm slow and tired (my usual state, it seems).

Any thoughts would be most appreciated. I also read that thanks could be expressed with a cheesecake . . .