# Quick question on preloaders

**URL:** <https://forum.kirupa.com/t/quick-question-on-preloaders/3003>\
**Category:** Uncategorized\
**Created:** [February 16, 2002, 4:02pm UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003 "2002-02-16T16:02:14Z")\
**Posts on this page:** 13\
**Page:** 1

<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:** [February 16, 2002, 4:02pm UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/1 "2002-02-16T16:02:14Z")

</div>

well i was wondering if there was anything wrong with this code. I used the tut that Upu put in this forum, but i changed it a little…i was wondering if my substituting the “remaining” variable at the end would change anything. I can’t really test this cuz i only have a couple MCs and the file is only 6 KB so it loads too fast for me to see if the script is working…

total = getBytesTotal()/1000;  
loaded = getBytesLoaded()/1000;  
percentage = (loaded/total)\*100;  
remaining = total-loaded;  
setProperty (“bar”, \_xscale, percentage);  
if (remaining\<=0) {  
gotoAndPlay (3);  
}

all this is in the first frame w/ the loop in the second frame

**just realize that this probly should have gone in Upu’s _preloaders rererevisted_ post, sorry**

---

<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:** [February 16, 2002, 5:02pm UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/2 "2002-02-16T17:02:48Z")

</div>

I think that should work… though I still think that the !=0 is necessary. If the total and the loaded, are both equal to 0 at once, which sometimes happens in the first second of a movie loading, you’re script will make it play, even if it isn’t ready to be played.

My suggestion would be this

total = getBytesTotal()/1000;  
loaded = getBytesLoaded()/1000;  
percentage = (loaded/total)\*100;  
remaining = total-loaded;  
setProperty (“bar”, \_xscale, percentage);  
if (remaining\<=0&&loaded!=0) {  
gotoAndPlay (3);  
}

this will ensure that it will not play unless something is loaded.

---

<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:** [February 16, 2002, 5:13pm UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/3 "2002-02-16T17:13:00Z")

</div>

ok, i was just trying to use somehting htat i understood more fully, but you explained the != so i’ll use that…thanks upu

\*\* thanks upu, it worked perfectly.\*\*

---

<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:** [February 16, 2002, 6:40pm UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/4 "2002-02-16T18:40:21Z")

</div>

another question upu…is there anyway that i can display the numbers as whole numbers? and not that 1.000024830929349323240438209375814702 that shows up?

---

<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:** [February 16, 2002, 6:43pm UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/5 "2002-02-16T18:43:21Z")

</div>

Yes… but I haven’t gotten that working yet… Suprabeener has an explination somewhere, I’ll look for 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:** [February 16, 2002, 7:19pm UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/6 "2002-02-16T19:19:24Z")

</div>

ok thanks up.

---

<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:** [February 17, 2002, 12:11am UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/7 "2002-02-17T00:11:00Z")

</div>

If you want to see your preloader, hit ctrl + enter, then hit ctrl + enter again. ( Do it twice). You will be able to see your preloader.

---

<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:** [February 17, 2002, 12:33am UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/8 "2002-02-17T00:33:23Z")

</div>

Math.round(num);

or .ceil or .floor

---

<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:** [February 17, 2002, 1:41am UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/9 "2002-02-17T01:41:37Z")

</div>

thanks supra…

if this is my code…

total = getBytesTotal()/1000;  
loaded = getBytesLoaded()/1000;  
percentage = (loaded/total)\*100;  
remaining = total-loaded;  
setProperty (“bar”, \_xscale, percentage);  
if (loaded\>=total && total != 0) {  
gotoAndPlay (3);  
}

where do i put that?

---

<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:** [February 17, 2002, 2:57am UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/10 "2002-02-17T02:57:32Z")

</div>

which variables do you want to round?

---

<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:** [February 17, 2002, 3:14am UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/11 "2002-02-17T03:14:41Z")

</div>

oh sorry…i want to round percentage.

---

<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:** [February 17, 2002, 3:20am UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/12 "2002-02-17T03:20:15Z")

</div>

percentage = Math.round((loaded/total)\*100);

---

<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:** [February 17, 2002, 3:22am UTC](https://forum.kirupa.com/t/quick-question-on-preloaders/3003/13 "2002-02-17T03:22:15Z")

</div>

kool thanks!
