A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Get combined totalFrames of a number of externally loaded swfs.

  1. #1
    Senior Member
    Join Date
    Oct 2005
    Posts
    198

    Unhappy Get combined totalFrames of a number of externally loaded swfs.

    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
    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;
    			
    				
    			
    			}
    			
    		}
    Thanks,
    --Yvette
    Last edited by yvillicana; 05-02-2013 at 07:27 PM.

  2. #2
    Senior Member
    Join Date
    Oct 2005
    Posts
    198
    Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center