Does anyone know how to make a preloader with a rate of download eg. 7kb/s and time left to load?
i have a percentage and load bar already, what can i add in the code to find the rate?
Does anyone know how to make a preloader with a rate of download eg. 7kb/s and time left to load?
i have a percentage and load bar already, what can i add in the code to find the rate?
i dunno man… i been trying to figure that one out as well…
im guessing u gotta get the current loaded… and do something with it… !!!
yes, use Kirupa’s stunning preloader tutorial and rig the code and such as I have here. This site is massive and the original movie is not my design but you can see an example of my rate calculating in the makeshift preloader I wrote for this kid so the movie wouldn’t begin to play and **** up as it loads and people try to navigate. It seems to be accurate after a few seconds which was hard to achieve due to the strain on the flash engine that my method imposes. Here’s the A.S. and you can email me for the source if you so choose. Maybe Kirupa could convince me to write a tut on it but it’s doubtful.
FRAME 1
[AS]bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
_root.loadBar._width = getPercent100;
_root.loadText = Math.round(getPercent100)+"%";
_root.loadSpeed = Math.round(bytes_loaded/getTimer())+" KB/s";
if (bytes_loaded == bytes_total) {
_root.gotoAndPlay(3);
}[/AS]
FRAME 2
[AS]
gotoAndPlay(1);
[/AS]
FRAME 3-END
movie…
I had to play around with it and you’ll find that in rounding and declaring vars etc… you loose accuracy and it also takes a while to ‘build up’ to a correct speed. Holla!:thumb:
Also, I rigged this in a few mins so if anyone can streamline it to more accurately guage the speed in flash, jump in and tear my ****ty code to pieces. (Most of the code is however from the tut)
there is a tut with that at www.ultrashock.com
where if you don’t mind?
thanks man, that helps heaps… i will post the product when i have finished it
thanks for that, im gonna try it out…
no problem, see if you can tweak it to get the speed more accurate but without early rounding that accounts for the wavering, the calculations are too involved thus creating the long build up to a correct measure
yeh i will try… it will take a bit of time to perfect it tho… but who would of thought that to get the rate was only one extra line
hey i think i figured it out to make it more accurate…
here is the code…
var total = getBytesTotal();
var loaded = getBytesLoaded();
var percent = loaded/total;
this.loadbar._width = percent*this.outline._width;
var thePercent = Math.ceil(percent * 100);
var Rate1 = this.loadSpeed = Math.floor((loaded/getTimer())100)
var theRate = Rate1 / 100 + “KB/s”;
this.follow._x = percentthis.outline._width +85;
if (total == loaded) {
gotoAndPlay(3);
}
Ok…I have finished my beta of the preloader…
you can view it here
I managed to get the download rate working… and also the time left for it… here is the code
[AS]var total = getBytesTotal();
var loaded = getBytesLoaded();
var percent = loaded/total;
var done = Math.floor((total - loaded)/1000)+"Kb of " + Math.floor(total/1000) + “Kb”;
this.loadbar._width = percent*this.outline._width;
var thePercent = Math.ceil(percent * 100);
var Rate1 = this.loadSpeed = Math.floor((loaded/getTimer())100)
var theRate = Rate1 / 100;
var eta = Math.floor(((total-loaded)/theRate)/1000);
this.follow._x = percentthis.outline._width +85;
if (total == loaded) {
gotoAndPlay(3);
}[/AS]
tell me wot you guys think
nice, nice
:: Copyright KIRUPA 2024 //--