Monday, May 08, 2006

Old but good code

This is my preloader code, I know it's probably horribly outdated but it suits me good.

loadedbytes = getBytesLoaded();
totalbytes = getBytesTotal();
loadedkbytes = Math.ceil(loadedbytes/1000);
totalkbytes = Math.ceil(totalbytes/1000);
frame = Math.ceil(loadedbytes/(totalbytes/100));
loader.gotoAndStop(frame);
if (loadedbytes == totalbytes) {
nextScene ();
}