# Using LoadVars.getBytesLoaded and LoadVars.getBytesTotal

**URL:** <https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899>\
**Category:** flash\
**Created:** [September 1, 2003, 6:44pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899 "2003-09-01T18:44:51Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamza84](https://avatars.discourse-cdn.com/v4/letter/h/ea5d25/32.png) [@hamza84](https://forum.kirupa.com/u/hamza84)\
**Post date:** [September 1, 2003, 6:44pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/1 "2003-09-01T18:44:51Z")

</div>

hey peeps,  
Whenever i try to display anything returned by LoadVars.getBytesLoaded or Load…Total, it gives me NaN. Does anyone know how to overcome this problem? Thanks in advance

---

<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:** [September 1, 2003, 6:55pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/2 "2003-09-01T18:55:13Z")

</div>

Do you do this?

```auto

yourLoadedVars = new LoadVars();
yourLoadedVars.load("text.txt")
trace(yourLoadedVars.getBytesLoaded)

```

or are you just useing

```auto

LoadVars.load("text.txt")
trace(LoadVars.getBytesLoaded)

```

:}

---

<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:** [September 1, 2003, 6:59pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/3 "2003-09-01T18:59:56Z")

</div>

Master64, i dont think you can use that with LoadVars :-\

hamza84: do you need to display loading pregress or just a loading message?

---

<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:** [September 1, 2003, 7:02pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/4 "2003-09-01T19:02:45Z")

</div>

claudio, getBytesLoaded/Total is indeed a method of the LoadVars class 🙂

---

<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:** [September 1, 2003, 7:06pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/5 "2003-09-01T19:06:30Z")

</div>

oh my bad 🙂  
check this

---

<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:** [September 1, 2003, 7:07pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/6 "2003-09-01T19:07:50Z")

</div>

Master 64 - Wouldn’t that be

[AS]  
yourLoadedVars = new LoadVars();  
yourLoadedVars.load(“text.txt”)  
trace(yourLoadedVars.getBytesLoaded())  
[/AS]

---

<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:** [September 1, 2003, 7:11pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/7 "2003-09-01T19:11:04Z")

</div>

Ok i guess my last post was i bit confusing :-\

you can use yourLoadedVars.getBytesLoaded

but the way hamza84 sad it. it look like he/she was trying to use getBytesLoaded right of the class and not useing new …

Voetsjoeba sorry whated to answer quickly before you guys got there before me…[size=1] which happens alot :P[/size]

---

<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:** [September 1, 2003, 7:13pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/8 "2003-09-01T19:13:20Z")

</div>

Lol, 't is precies of we zijn hier aan’t racen voor nen thread op te losse 😛

hamza84 - Don’t forget the ()'s at the end of getBytesLoaded and getBytesTotal. The correct syntax is getBytesLoaded() and getBytesTotal().

---

<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:** [September 1, 2003, 7:15pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/9 "2003-09-01T19:15:12Z")

</div>

try something like this:

```auto
lv = new LoadVars();
lv.load("somefile.txt");
onEnterFrame = function() {
if(lv.getBytesLoaded()<lv.getBytesTotal()) trace ( 100*lv.getBytesLoaded()/lv.getBytesTotal() )
else delete this.onEnterFrame
}

```

---

<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:** [September 1, 2003, 7:16pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/10 "2003-09-01T19:16:32Z")

</div>

^ What ? You _don’t_ need the ()'s ? D’oh 😛 Oh well, another entry to my brain’s records won’t hurt.

---

<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:** [September 1, 2003, 7:17pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/11 "2003-09-01T19:17:04Z")

</div>

edited my post 😉

---

<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:** [September 1, 2003, 7:17pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/12 "2003-09-01T19:17:42Z")

</div>

ARGH ! Don’t confuse 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:** [September 1, 2003, 7:18pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/13 "2003-09-01T19:18:49Z")

</div>

G ahmed nice and all but… keep it simple for the newbies 😛

---

<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:** [September 1, 2003, 7:48pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/14 "2003-09-01T19:48:22Z")

</div>

Hey! wheres my say in this whole discussion!? Anyways, here;s the code that I used. In the first frame, I used this code:

[AS]loadtext = new LoadVars();  
loadtext.load(“about.txt”);[/AS]

In the second frame i used this code:

[AS]total = loadtext.getBytesTotal();  
loadedbytes = loadtext.getBytesLoaded();  
loading = Math.floor(loadedbytes/total);[/AS]

and finally, in the third frame, i used the following code:

[AS]if(loadedbytes \< total)  
gotoAndPlay(2);

else  
{  
box.html = true;  
box.htmlText = this.aboutText;  
this.stop;  
}[/AS]

I’m trying to display a message while the darn thing is loading. And btw, I’m a male. =)

---

<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:** [September 1, 2003, 8:02pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/15 "2003-09-01T20:02:25Z")

</div>

errrr

try

```auto

//1//
loadtext = new LoadVars();
loadtext.onLoad = function(){
        box.html = true;
        box.htmlText = this.aboutText;
       gotoAndStop(4);
}
loadtext.load("about.txt");
//2//
total = loadtext.getBytesTotal();
loadedbytes = loadtext.getBytesLoaded();
loading = Math.floor(loadedbytes/total);
//3//
gotoAndStop(2);

```

but its looks fine to 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:** [September 1, 2003, 8:05pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/16 "2003-09-01T20:05:24Z")

</div>

and your edit too 😉

exept

```auto

if(loadedbytes < total){
gotoAndPlay(2);
}else{
        box.html = true;
        box.htmlText = this.aboutText;
        this.stop**()**;
}

```

---

<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:** [September 1, 2003, 8:14pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/17 "2003-09-01T20:14:57Z")

</div>

I tried all of the codes. Still doesnt work. Wierd

---

<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:** [September 1, 2003, 8:27pm UTC](https://forum.kirupa.com/t/using-loadvars-getbytesloaded-and-loadvars-getbytestotal/29899/18 "2003-09-01T20:27:06Z")

</div>

try removeing you text fields and just trace the variable…  
if you have var in the “var” thing in text field and the text field is rested(if it come in a frame where the text field is make(which happen when you use gotoAndPlay()) the var gets reset… that might be the prob;)

Going to bed (school tomorrow ☹ )
