getBytesLoaded() & getBytesTotal()

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

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:


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

you can just use this instead of _root :wink:

this.getBytesLoaded();
this.getBytesTotal();

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

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

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

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.

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

Originally posted by glitch007
did you try what I tried with the _root.contents thing?

:stunned: i’m kinda lost here… :stuck_out_tongue:

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:


_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