Jump to content
Search Community

Playing Multiple FLVs at the same time

adamg test
Moderator Tag

Recommended Posts

Hello,

 

I am trying to preload 5 FLVs and then play all 5 at the same time. I am completely stumped, any help would be really appreciated.

 

Here is my code:

 

import com.greensock.*;

import com.greensock.loading.*;

import com.greensock.events.LoaderEvent;

import com.greensock.loading.display.*;

 

//create a LoaderMax named "mainQueue" and set up onProgress, onComplete and onError listeners

var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});

 

//append several loaders

queue.append( new VideoLoader("IT_01.flv", {name:"mainClip01", estimatedBytes:1900, width:175, height:265, scaleMode:"proportionalOutside", crop:true, container:this, x:20, y:10, autoPlay:false}) );

queue.append( new VideoLoader("IT_02.flv", {name:"mainClip02", estimatedBytes:1900, width:142, height:225, scaleMode:"proportionalOutside", crop:true, container:this, x:200, y:40, autoPlay:false}) );

queue.append( new VideoLoader("IT_03.flv", {name:"mainClip03", estimatedBytes:1900, width:142, height:225, scaleMode:"proportionalOutside", crop:true, container:this, x:340, y:40, autoPlay:false}) );

queue.append( new VideoLoader("IT_04.flv", {name:"mainClip04", estimatedBytes:1900, width:142, height:225, scaleMode:"proportionalOutside", crop:true, container:this, x:40, y:280, autoPlay:false}) );

queue.append( new VideoLoader("IT_05.flv", {name:"mainClip05", estimatedBytes:1900, width:142, height:225, scaleMode:"proportionalOutside", crop:true, container:this, x:200, y:290, autoPlay:false}) );

queue.append( new ImageLoader("sq_frame.png", {name:"photo1", estimatedBytes:500, width:550, height:550, container:this, x:-10, y:2, alpha:100, scaleMode:"proportionalInside"}) );

 

//start loading

queue.load();

 

function progressHandler(event:LoaderEvent):void {

trace("progress: " + event.target.progress);

myProgressBar.scaleX = event.target.progress;

}

 

function completeHandler(event:LoaderEvent):void {

trace(event.target + " is complete!");

}

 

function errorHandler(event:LoaderEvent):void {

trace("error occured with " + event.target + ": " + event.text);

}

 

stop();

Link to comment
Share on other sites

in your completeHandler you can use queue.getChildren() to get an array of all the loaders.

you can then loop through all the loaders and tell them to playVideo().

 

 

since you have an ImageLoader in there at the end you don't want to playVideo() on that loader.

when you loop through the loaders you can

 

- run the loop only 5 times if you know there will only be 5 videos

 

or

 

- use a conditional statement to make sure that the loader is a VideoLoader

 

something like:

 

if(myArrayOfLoaders[i] is VideoLoader){
    myArrayOfLoaders[i].playVideo();
}else{
   trace("found a loader that isn't a VideoLoader");
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...