PDA

View Full Version : playing multiple flvs


Navarone
01-02-2007, 04:45 PM
I am trying to get my code to work here and not having much luck. Can some one point me in the right direction. I need the flvs in my array to play one after the other continuously. :confused:


vidList = new Array("item_overview_ae476x264768K.flv", "item_applications_ae476x264768K.flv", "unlimited_possibilities_ae476x264768K.flv", "create_linear_ae476x264768K.flv", "change_applications_ae476x264768K.flv", "german_engineered_ae476x264768K.flv", "item_difference_ae476x264768K.flv", "320_profiles_ae476x264768K.flv", "structural_aluminum_ae476x264768K.flv", "profile_cost_ae476x264768K.flv", "precision_tolerances_ae476x264768K.flv", "aesthetics_ae476x264768K.flv", "item_DoForYou_ae476x264768K.flv", "getting_started_ae476x264768K.flv", "complete_package_ae476x264768K.flv");
//
var i = 0;

// call func for the first time
function playMovie() {
_root.stop();
_root.display.stop();
_root.display.autoPlay = true;
_root.display.activePlayControl = true;
_root.display.controllerPolicy = 'on';
_root.display.setMedia("../videos/"+vidList[i].startMovie, "FLV");
_root.display.play(0);
_root.myController.volume = 100;
//////////////////////////////////////
var myListener = new Object();
myListener.complete = function(eventObject) {
trace("one - media is Finished");
if (vidList[i] == done) {
playMovie();
}
// increment i
i++;
};
}
_root.display.addEventListener("complete", myListener);
//

alpine2007
01-02-2007, 05:48 PM
here is a working sample that I created a week ago. I use flvplayback component and the smil.xml files to play multiple flv video files(text file keeps the number of videos). hope this helps.
import mx.video.*;
_root.myLoadVars = new LoadVars();
_root.myLoadVars.onLoad = function(succes)
{
if(succes)
{
videoNum = this.videoNumber;
//trace(_root.videoNum);
}
else
{
trace("error");
}
};
_root.myLoadVars.load("info.txt");
var checkNum = 1;

var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
checkNum++;
if (checkNum<=videoNum){
Video_ply.contentPath = "fms/smil"+checkNum+".xml";
}
};
Video_ply.addEventListener("complete", listenerObject);
Video_ply.contentPath = "fms/smil1.xml";

Navarone
01-02-2007, 07:06 PM
thanks, I might have to resort to that.

I tried something like this, but it only plays the last video in the array and not the incrementally.


var i = 0;
// call function
playMovie();
//
function playMovie() {
for (i=0; i<15; i++) {
trace("../videos/"+vidList[i]+"");
_root.display.stop();
_root.display.autoPlay = true;
_root.display.activePlayControl = true;
_root.display.controllerPolicy = 'on';
_root.display.setMedia("../videos/"+vidList[i]+"", "FLV");
_root.display.play(0);
_root.myController.volume = 100;
var myListener = new Object();
myListener.complete = function(eventObject) {
trace("one - media is Finished");
_root.display.setMedia("../videos/"+vidList[i]+"", "FLV");
_root.display.play(0);
};
_root.display.addEventListener("complete", myListener);
}
}
//

Navarone
01-03-2007, 06:58 PM
I came up with my own solution for those who might like to do something similar;)

var i = 0;
// call function
playMovie();
//
function playMovie() {
trace("../videos/"+vidList[i]+"");
//for (i=0; i<15; i++) {
_root.display.stop();
_root.display.autoPlay = true;
_root.display.activePlayControl = true;
_root.display.controllerPolicy = 'on';
_root.display.setMedia("../videos/"+vidList[i]+"", "FLV");
_root.display.play(0);
_root.myController.volume = 100;
//
var myListener = new Object();
myListener.complete = function(eventObject) {
trace("one - media is Finished");
i = i+1;
_root.display.setMedia("../videos/"+vidList[i]+"", "FLV");
_root.display.play(0);

};
//}
_root.display.addEventListener("complete", myListener);
}
//