Hi,
I understand that in order to get the totalFrames you need to use a ProgressEvent listener---I have a number of swfs that I need to load and as they are being loaded I need a way to add up all the totalFrames of each external swf and keep track of the length of each swf within an array...Does any one know how to do this?
I have some code, but it's pretty worthless:
this bLoad function is called within the init() funtion
Thanks,Code:private function bLoad():void { //this bLoad function is called within the init() funtion imgLoader = new Loader(); imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener); imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded); for (var i=1; i<totalSwfs; i++) { //totalSwfs is declared as a private var uint with a value of 30 var pieceURL:String = "piece" + i + ".swf"; //the external swfs are named piece1, piece2,piece3......piece30 imgLoader.load(new URLRequest(pieceURL)); } } private function progressListener(e:ProgressEvent):void { var i:uint = 1; trace("loaded", e.bytesLoaded, e.bytesTotal); //MovieClip(imgLoader.content).totalFrames; this["totaltime"+[i]] = MovieClip(imgLoader.content).totalFrames; //totaltime is declared as an Array within the Main class constructor //trace(MovieClip(imgLoader.content).totalFrames); trace(this["totaltime"+[i]]); ttime += this["piece" + [i]]; //ttime is declared as private var truntime:uint = 0 within the constructor class for (var p = 1; p<i; ++p) { pieceswf[i] = ttime - this["piece" + [i]]; } ++i; } }
--Yvette


Hi,
Reply With Quote