# Ok ... a preloader

**URL:** <https://forum.kirupa.com/t/ok-a-preloader/2933>\
**Category:** Uncategorized\
**Created:** [December 8, 2001, 8:33am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933 "2001-12-08T08:33:51Z")\
**Posts on this page:** 20\
**Page:** 2

<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:** [December 27, 2001, 3:58pm UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/21 "2001-12-27T15:58:35Z")

</div>

\<|Textoxes|\>\rbloaded (Bytes Loaded)\rbtotal (Bytes Total)\rbleft (Bytes left)\rbpercent (Bytes Loaded in %percents%)\r\<|Actions|\>\r\<\<Frame1\>\>\r\_root.bloaded = getBytesLoaded;\r\_root.btotal = totalBytes;\r\_root.bleft = btotal-bloaded;\r\_root.bpercent = (bloaded/btotal)\*100;\rifFrameLoaded(3) {\rgotoAndStop(3)\r}\r\r\<\<Frame2\>\>\rgotoAndPlay(1);\r\r------------------------------------------\rAnd when I upload it onto internet It shows me this :rolleyes: !!!\r\rbloaded = “[Type Action]”\rbtotal = " " (nothing)\rbleft = “0”\rbpercent = “NaN”\r--------------These are like typed in the textboxes-----------\rok so… by the way the movie is\r[Syko171](http://www.hot.ee/syko171)\rNB! IT IS NOT COMPLETED That’s just A little % of the whole movie so… . . . . .

---

<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:** [December 28, 2001, 3:28am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/22 "2001-12-28T03:28:57Z")

</div>

you forgot the underscores before these two  
they should be

\_getBytesLoaded;  
and  
\_totalBytes;

not

getBytesLoaded  
and  
totalBytes

🙂 common mistake.

---

<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:** [December 28, 2001, 9:41am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/23 "2001-12-28T09:41:33Z")

</div>

## nope…no use by the way before it was getBytesLoaded and it was blue now its \_getBytesLoaded and it’s not blue (it’s black) but totalBytes/\_totalBytes is still the same It was Black before and is black now… I uploaded it again with new ationscript (\_getBytesLo…) You can check it, it’s still the same (www.hot.ee/syko171) check it if you want but… well I duno what’s wrong…

😃 lol:D Cool I made a Topic that as 2 pages… Cool 😃 lol:D

---

<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:** [December 28, 2001, 1:25pm UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/24 "2001-12-28T13:25:47Z")

</div>

Lol… I’m an idiot… I should just post you an FLA. I’m working on one now. I’ll figure this out if it kills me

---

<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:** [December 28, 2001, 2:50pm UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/25 "2001-12-28T14:50:26Z")

</div>

ok… it was just a couple of syntax errors… no biggie. you were missing a couple of (), and I had inadvertantly given you the wrong info.

this is an example I made with an MP3. It is 2 megs, so only fast connection people should bother to download the whole thing, but it’s large so you can see the preload in action.  
[www.centerspin.com/downlo…loader.swf](http://www.centerspin.com/download/preloader.swf)  
for slower connections this is one I did with a peice of artwork. It’s 300k maybe.  
[www.centerspin.com/downlo…oader2.swf](http://www.centerspin.com/download/preloader2.swf)

this is the source. it’s 300k or so.  
[www.centerspin.com/downlo…loader.fla](http://www.centerspin.com/download/preloader.fla)

---

<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:** [December 28, 2001, 5:20pm UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/26 "2001-12-28T17:20:00Z")

</div>

Hey thanks for helping me out here. but… hey what was the Ascript for rounding things. I don’t want it to show 76.131312124345% but 76.13%  
It was something like Math.round(); or something… I don’t remember exactly…

---

<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:** [December 28, 2001, 6:11pm UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/27 "2001-12-28T18:11:58Z")

</div>

are Math.round and math.Round the same thing? because I used math.Round and the code didn’t turn blue but it worked. thanks guys. -Brian

---

<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:** [December 28, 2001, 7:03pm UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/28 "2001-12-28T19:03:10Z")

</div>

they are the same thing… capitals don’t count in flash…

say if u had the variable

tdfIsCool and later on u had TDFIsCool as another variable, it would still be the same thing, flash ignores the capital letters in names.

---

<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:** [December 29, 2001, 2:24am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/29 "2001-12-29T02:24:06Z")

</div>

That is not exactly true. If it’s a flash function, you need to keep the caps as the program requires it. I’ll take a look at the file and see what is up with that command Math.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:** [December 29, 2001, 7:33am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/30 "2001-12-29T07:33:33Z")

</div>

it looks to me like it should be  
Math.round(whatEverMathYoureDoingGoesInHere);

---

<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:** [December 29, 2001, 8:02am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/31 "2001-12-29T08:02:34Z")

</div>

Ok… so I want it to round a number a…e…  
not 13.12646342523  
but 13.13  
How do I do that  
Math.round(…:rolleyes: …)  
How to do 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:** [December 29, 2001, 8:26am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/32 "2001-12-29T08:26:37Z")

</div>

SUPRABEENER WHERE ARE YOU!??? :lol: !!

you’re full of questions. Good one too. I’ll try to find it in a book I’ve got.

(in case you don’t get the joke, Supra is my safty net… handling all these hard questions for me… Though I think if he saw the beginning of this post he’d smack me in the head for all the errors I made. 🙂 )

---

<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:** [December 29, 2001, 12:02pm UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/33 "2001-12-29T12:02:30Z")

</div>

what i ment was it doesnt count if its your own variables…  
but he was asking about a function, so its my bad. 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:** [December 29, 2001, 2:50pm UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/34 "2001-12-29T14:50:11Z")

</div>

Ye I got the joke…  
So… how to do it then?  
Math.round(…).  
I hope that Supra knows and checks the topic out soon…  
I’m gonna make the preloader that it’s not 3.24214214 but 3.24 and not that the numbers are in bytes but megabytes (bLoaded_1024_1024) \<–piece a cake:)

Syko

---

<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:** [December 29, 2001, 4:53pm UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/35 "2001-12-29T16:53:47Z")

</div>

Hey tdfwrestling!  
That banner is HARD COOL!  
I wish I could do something like that…  
Is there a lot of actionscript? (…well I guess so).  
No big animation (circles just getting bigger and moving) but it gives a COOOL effect!!!

---

<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:** [December 29, 2001, 5:36pm UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/36 "2001-12-29T17:36:56Z")

</div>

i think i’ve seen better solutions but…

you might multiply it by 100, then round, then divide by 100. you could make it an extension of the Math object

```auto
 
Math.roundto(num,n){
&nbsp &nbsp &nbsp &nbsp num = Math.round(num*n);&nbsp &nbsp &nbsp &nbsp 
&nbsp &nbsp &nbsp &nbsp return(num/n);
}

```

- num\* is the number to round and \* n\* is the number of decimal points, so Math.roundto(3.14159265,10); should return 3.14.

i’m on a non-flashed computer right now so i couldn’t test that code … hope it works. ; )

---

<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:** [December 31, 2001, 10:45am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/37 "2001-12-31T10:45:31Z")

</div>

I made a tester and the script is (Frame 1)

bLoaded = getBytesLoaded();  
bTotal = getBytesTotal();  
bLeft = (bTotal-bLaoded);  
bPercent = (bLoaded/bTotal);  
ifFrameLoaded(3) {  
gotoAndStop(3);  
}

(Frame2)

gotoAndPlay(1);

* * *

ok so there are no rounding action or nothing…  
There is something wrong I made some modifications to it on my PC so the script is (Frame1)  
(I made the modifications only to bTotal cus that way I can seee it on my PC by removing ifFrameLoaded(); action and adding stop(); action)

bLoaded = getBytesLoaded();  
bTotal = getBytesTotal();  
bLeft = (bTotal-bLaoded);  
bPercent = (bLoaded/bTotal);  
bTotal = (bTotal_1024_1024);  
stop();  
}

I added the line  
bTotal = (bTotal_1024_1024);  
to make it not bytes but mb  
:rolleyes: It Doesn’t Work :rolleyes:  
I didn’t test the Math.round action yet cuz first I wanted to get this over with…  
It still shows me the BIG and LONG number of BYTES :rolleyes:

any good ideas?

---

<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:** [December 31, 2001, 11:14am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/38 "2001-12-31T11:14:36Z")

</div>

try ((bTotal\*1024)\*1024)

---

<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:** [December 31, 2001, 11:54am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/39 "2001-12-31T11:54:58Z")

</div>

Sorry… LOL… don’t listen to that. What the hell am I thinking…

I’ll try to plug this in and see what I can make out of it. Sorry for jumping to that redundency.

---

<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:** [January 2, 2002, 3:07am UTC](https://forum.kirupa.com/t/ok-a-preloader/2933/40 "2002-01-02T03:07:02Z")

</div>

i got back to a flashed machine a found a few things wrong with the code for rounding.

i defined the method incorrectly, should be:

```auto
  
Math.roundto = function(num,n){
        num = Math.round(num*n);        
        return(num/n);
}

```

and you should make \* n\* equal 100 to round to the nearest hundreth, not 10 as i said earlier.

shouldn’t you be \* dividing\* by 1024 to get mb from bytes?

[Previous page](https://forum.kirupa.com/t/ok-a-preloader/2933.md?page=1)

[Next page](https://forum.kirupa.com/t/ok-a-preloader/2933.md?page=3)
