PDA

View Full Version : How Do You Fetch the Total Bytes of a File Before Loading It?



MoOMoOMiLK
July 31st, 2008, 04:19 PM
I am just wondering how I can find out the size of a file before loading it in AS3. The property bytesTotal only works after you start loading the file. What I am trying to do here is to load a sequence of files one by one showing only one preloader which takes the percentage of bytes loaded over the total bytes of all the files.

Thanks in advance.

dthought
July 31st, 2008, 09:36 PM
I just use BulkLoader for that. Feed it a list of things, and it'll return you a collective value.

It's at http://code.google.com/p/bulk-loader/

If you're crazy and paranoid about code overhead, of course you can write your own code to do something like this, but BL has some nice handling features, like being able to return you pre-prepared results based on if you're loading a SWF, JPG, MP3 etc. etc.

:)