As you can see, I’m dynamically loading 6 images into 6 boxes (containers). What I’m trying to make is preloader that shows the loading-status of all six images. So I need the totals (total filesize of the 6 images, and the total amount of loaded bytes)… But it doesn’t seem to work this way
You seem to be loading all your images into one container which is not possible so your code will be only loading the last image (image_6.jpg). Try creating 6 different containers and loading each image to a different one, or loading each image to a different level using loadMovieNum.
Hope this helps, let me know if you need any more help
I’m actually loading them into 6 different clips, mcBox1 to mcBox6, which are indeed located within mcContainer. Are you sure that [FONT=courier new]_root.mcContainer.mcBox1.mcPhotoContainer.getBytesTotal()[/FONT] won’t work?
I’m really confused…
Could you use some code to explain your point please?
yea, sorry I completely miss-read your post like a *******.
not quite sure exactly what’s going wrong here, what kind of results are you getting?
only thing I can suggest from looking at your code is this:
in preload array you’re storing a series of objects and then using it later to address the relevent image container. I’ve never seen this method before, so am not sure if it works (if you know better then let me know). Rather than storing your objects in an array you could address the ojects like this (in your preload images function):
The storing and addressing of objects in an array works perfectly fine, but what bothers me is that, whenever I trace the getBytesTotal of each individual clip, it outputs 4… So I’m guessing that’s the size of the clip WITHOUT any images in it.
Also, the images are loaded… they’re just not preloaded
yea as I remember 4 bytes is the exact size of an empty movie clip which would suggest that nothing has yet been loaded.
I had a problem a while back wich was similar to this that turned out to be caused by the fact I was inspecting the empty movie clip too soon after telling it to load a movie. When you tell flash to load a movie flash then has to get the relevent files header that contains information such as filesize. Looks to me that your code is being executed before this has been done. Try running your preload code every frame and see what sort of results you get back.
Hmm… I noticed one error that you couldn’t have known about: At the bottom of preloadImages, I called the same function again, instead of using setInterval.
Now that I’m using setInterval I seem to get an accurate amount bytes, but only AFTER the entire thing’s been loaded (no inbetweens)… which is strange, because I trace the values within the preloadImages function which should at least be called 5 times during the loading process…
if you are then the whole image will load when the file header loads so there won’t be any delay between flash recieving the file header and flash recieving the whole file, hence getBytesTotal() goes from returning 4 to showing the right amount AND getBytesLoaded() showing the same number
try uploading your images to a web server and using their url in your movie to test with, its the only way you can test a preloader from a local machine