im using the code below to load an array of videos from php then play them back with a neat little loader of the next video while the previous is playing which helps to play them without any gaps. I need to preload the first video though with a preloading screen and also once all the videos have finished to redirect the user to another page, im stuck with those two things though
// Set Videos Behavior
var videos:Object = new Object();
// Set Initial video list
videos.list = new Array();
videos.list[0] = "italian.flv"; // initial screen
videos.loop = true;
//videos.length = 1;
videos.loaded = false;
//var totalp = 1;
// Path to FLVPlayback components
var m = this.myVideo;
// Set the path of the first video feed
m.contentPath = videos.list[0];
//m.addASCuePoint(3, "firstCue");
// Set a 'ready' event handler to load the videos
videos.ready = function(evt:Object):Void {
//var totalv = this.length;
//trace(totalv);
if (!this.loaded) {
this.loaded = true;
for (var n = 0; n<this.list.length; n++) {
if (videos.list[n].indexOf(".flv") != -1) {
m.activeVideoPlayerIndex = n;
m.contentPath = videos.list[n];
this.length++;
//m.addASCuePoint(3, "secondCue");
}
}
m.activeVideoPlayerIndex = 0;
//trace(totalv);
}
};
m.addEventListener("ready", videos);
// Set a 'complete' event handler to load the next video
videos.complete = function(evt:Object):Void {
var nextIndex = Number(evt.vp)+1;
if (nextIndex == this.length) {
if (this.loop) {
nextIndex = 0;
} else {
return;
}
}
m.activeVideoPlayerIndex = nextIndex;
m.visibleVideoPlayerIndex = nextIndex;
//totalp++;
m.play();
};
m.addEventListener("complete", videos);
// End Set Videos Behavior
// Set Video Index Behavior
this.myVideo.stop();
this.myVideo.activeVideoPlayerIndex = 0;
this.myVideo.visibleVideoPlayerIndex = 0;
this.myVideo.play();
// End Set Video Index Behavior
//setup a variable to hold the data\
var phpCall:LoadVars = new LoadVars();
phpCall.onLoad = initializePlay;
phpCall.load("movie.php");
phpCall.onLoad = function(status) {
if (!status) {trace(status);}
var movies:Array = [];
movies = this.movs.split(",");
for (var i=0;i <movies.length; i++) {
// move the .flv location to the video list
videos.list* = movies*;
}
videos.loop = true;
};
//var totalv = movies.length;
//if(totalp > totalv) {
//getURL("http://www.google.co.uk");
//}