PDA

View Full Version : preload math



pspecial
June 22nd, 2003, 03:40 PM
Using this preloader w/percentage from the kirupa tut.

bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
this.gotoAndPlay(3);
}


I'm having trouble calculating the getBytesTotal method to return less that the total. In other words, I'd like to start the movie before it has fully loaded. Lets say, 75% loaded then gotoAndPlay.

Anyone know how to do this??

thoriphes
June 22nd, 2003, 06:05 PM
just go
if (bytes_loaded >= 0.75*this.getBytesTotal()) {
//do yo thang
}

pspecial
June 23rd, 2003, 12:59 PM
okay this works but...

the movie launches after load bar reads 50%

what I wanna do is have the bar read 100% even though the movie is only 75% loaded.

Basically, I want to fool the user that the movie is loading more quickly than it actually is. I'm counting on the remainder loading while the user reads the 1st page.

thoriphes
June 23rd, 2003, 08:14 PM
ah. then start the bar scale at 25, so when it gets to 100, it'll really only be 75 ;)

(sneeky).