Does anyone know if there is a way to track the progress of a group or queue of images and sounds. I am dynamically loading sounds and images (over 500 of each) and have no way to track the progress. Any help would be appreciated.
Load all your sounds and images into one movieclip. Then, you can look at yourMC.getBytesLoaded() and yourMC.getBytesTotal(); For example, do this: createEmptyMovieClip('thestuff',1); thestuff.mySound = new Sound(); thestuff.mySound.loadSound('someFile.wav'); thestuff.createEmptyMovieClip('image1'); thestuff.image1.loadMovie('image_1.jpg'); thestuff.onEnterFrame = function(){ trace(String(this.getBytesLoaded()/this.getBytesTotal()*100)+'% Complete'); if(this.getBytesLoaded()==this.getBytesTotal()&&this.getBytesTotal()!=0){ delete this.onEnterFrame } }
Or another way: filesLoading = new Array(); mySound = new Sound(); mySound.loadSound('someFile.wav'); createEmptyMovieClip('image1'); image1.loadMovie('image_1.jpg'); filesLoading.push(mySound); filesLoading.push(image1); getProgress(filesLoading); setInterval(getProgress,1000,filesLoading); function getProgress(someArray){ tload = 0; ttotal = 0; for(x=0;x<someArray.length;x++){ tload+=someArray[x].getBytesLoaded(); ttotal+=someArray[x].getBytesTotal(); } info = new Array(tload,ttotal); trace(''+tload+'/'+ttotal); return info; }
Don't see what you're looking for? Try a search.
|