# Preloaders

**URL:** https://forum.kirupa.com/t/preloaders/26899
**Category:** Uncategorized
**Created:** [July 28, 2003, 2:46am UTC](https://forum.kirupa.com/t/preloaders/26899 "2003-07-28T02:46:04Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Gauge](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@Gauge](https://forum.kirupa.com/u/Gauge)
#### Post date: [July 28, 2003, 2:46am UTC](https://forum.kirupa.com/t/preloaders/26899/1 "2003-07-28T02:46:04Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 2:48am UTC](https://forum.kirupa.com/t/preloaders/26899/2 "2003-07-28T02:48:24Z")

</div>

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… !!!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 3:30am UTC](https://forum.kirupa.com/t/preloaders/26899/3 "2003-07-28T03:30:14Z")

</div>

yes, use Kirupa’s stunning preloader tutorial and rig the code and such as I have [here](http://www.carolinaautoimport.com). 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 = getPercent_100;  
\_root.loadText = Math.round(getPercent_100)+"%";  
\_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:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 3:35am UTC](https://forum.kirupa.com/t/preloaders/26899/4 "2003-07-28T03:35:06Z")

</div>

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) 😏

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 3:37am UTC](https://forum.kirupa.com/t/preloaders/26899/5 "2003-07-28T03:37:06Z")

</div>

there is a tut with that at [www.ultrashock.com](http://www.ultrashock.com)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 3:41am UTC](https://forum.kirupa.com/t/preloaders/26899/6 "2003-07-28T03:41:37Z")

</div>

where if you don’t mind?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 3:58am UTC](https://forum.kirupa.com/t/preloaders/26899/7 "2003-07-28T03:58:38Z")

</div>

thanks man, that helps heaps… i will post the product when i have finished it 😃

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 4:00am UTC](https://forum.kirupa.com/t/preloaders/26899/8 "2003-07-28T04:00:20Z")

</div>

thanks for that, im gonna try it out…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 5:55am UTC](https://forum.kirupa.com/t/preloaders/26899/9 "2003-07-28T05:55:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 6:35am UTC](https://forum.kirupa.com/t/preloaders/26899/10 "2003-07-28T06:35:24Z")

</div>

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 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 7:04am UTC](https://forum.kirupa.com/t/preloaders/26899/11 "2003-07-28T07:04:37Z")

</div>

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 = percent_this.outline.\_width +85;  
if (total == loaded) {  
gotoAndPlay(3);   
}

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 11:27am UTC](https://forum.kirupa.com/t/preloaders/26899/12 "2003-07-28T11:27:08Z")

</div>

Ok…I have finished my beta of the preloader…  
you can view it [here](http://www.rflan.org/preloader.html)

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 = percent_this.outline.\_width +85;  
if (total == loaded) {  
gotoAndPlay(3);   
}[/AS]

tell me wot you guys think

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 28, 2003, 1:18pm UTC](https://forum.kirupa.com/t/preloaders/26899/13 "2003-07-28T13:18:56Z")

</div>

nice, nice
