# getBytesLoaded() & getBytesTotal()

**URL:** <https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402>\
**Category:** flash\
**Created:** [April 4, 2003, 7:03pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402 "2003-04-04T19:03:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![glitch007](https://avatars.discourse-cdn.com/v4/letter/g/ad7895/32.png) [@glitch007](https://forum.kirupa.com/u/glitch007)\
**Post date:** [April 4, 2003, 7:03pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402/1 "2003-04-04T19:03:25Z")

</div>

Say I have 2 files (file a, file b) and I want to use file a to load file b (in a blank movie clip symbol). The problem is that file b has a preloader that uses \_root.getBytesLoaded() & \_root.getBytesTotal() in it.

These values, however, return the size of ‘file a’, what should I put in place of \_.root (which is in ‘file b’) so that it returns the size of ‘file b’ even if I load it from somewhere else?

Thanks

---

<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:** [April 4, 2003, 7:36pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402/2 "2003-04-04T19:36:49Z")

</div>

I found out that you can refer to instances of symbols of file a by using \_root.someVariableName. So instead of having just \_root, I needed \_root.contents (contents is the instance name of my blank movie clip)

The final code will then read:

```auto

_root.contents.getBytesLoaded() 
_root.contents.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:** [April 4, 2003, 8:24pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402/3 "2003-04-04T20:24:39Z")

</div>

you can just use **this** instead of **\_root** 😉

```auto
this.getBytesLoaded();
this.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:** [April 4, 2003, 8:28pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402/4 "2003-04-04T20:28:51Z")

</div>

I tried that b4, but ‘this’ will refer to the preloader’s movie clip (not the empty movie clip which I called ‘contents’), that’s y it didn’t work

thanks anyway

---

<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:** [April 4, 2003, 8:34pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402/5 "2003-04-04T20:34:57Z")

</div>

so the preloader is in a movie clip in the external movie? :-  
then you use **\_parent**

---

<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:** [April 4, 2003, 8:46pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402/6 "2003-04-04T20:46:24Z")

</div>

Yeah, the preloader was from file b (but I was loading file b from ‘contents’ in file a)

I don’t know why it didn’t work, it was a preloader i found on this site:

[http://www.kirupa.com/developer/mx/percentage\_loader.htm](http://www.kirupa.com/developer/mx/percentage_loader.htm)

---

<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:** [April 4, 2003, 8:59pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402/7 "2003-04-04T20:59:09Z")

</div>

hmmm… i just downloaded the source from the tutorial.  
after a quick look at the scripts, the preloader won’t work with any external file :-\

**edit.** i should specify… it won’t work loading into a movie clip.  
you shouldn’t have any problems loading into levels.

---

<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:** [April 4, 2003, 9:03pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402/8 "2003-04-04T21:03:22Z")

</div>

did you try what I tried with the \_root.contents thing?

---

<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:** [April 4, 2003, 9:16pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402/9 "2003-04-04T21:16:20Z")

</div>

> _Originally posted by glitch007_  
> **did you try what I tried with the \_root.contents thing?**

:stunned: i’m kinda lost here… 😛

---

<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:** [April 4, 2003, 9:20pm UTC](https://forum.kirupa.com/t/getbytesloaded-getbytestotal/17402/10 "2003-04-04T21:20:10Z")

</div>

I posted a reply to myself just in case others wanted to know how to do it, i substitued the bytes loaded/total code from the original, so it became:

```auto

_root.contents.getBytesLoaded()
_root.contents.getBytesTotal()

```

So the preloader in file b will use the size of the ‘contents’ movie clip in file a which is what I originally wanted
