PDA

View Full Version : Loop FLV


Kevpool1
09-07-2006, 06:04 PM
I have a movie that plays three videos when the swf is loaded, I want to know if there is a way to continuosly loop these videos one after the other. Here is my code at present:


my_FLVPlybk.volume = 0;
my_FLVPlybk.contentPath = "0.flv";
var listenerObject:Object = new Object ();
listenerObject.stopped = function (eventObject:Object):Void
{
my_FLVPlybk.contentPath = "1.flv";
listenerObject.stopped = function (eventObject:Object):Void
{
my_FLVPlybk.contentPath = "2.flv";
};
};

mrand01
09-07-2006, 06:50 PM
var flvPlayback:FLVPlayback;
var arrMovies:Array = new Array("Movie1.flv", "Movie2.flv", "Movie3.flv");
var nMovies:Number = arrMovies.length;
var nCurrentMovie:Number = 0;
var objListen:Object = new Object();

objListen.complete = function(objEvent:Object)
{
if (nCurrentMovie == nMovies)
{
nCurrentMovie = 0;
}
else
{
nCurrentMovie++;
}

flvPlayback.play(arrMovies[nCurrentMovie]);
}

flvPlayback.volume = 0;
flvPlayback.addEventListener("complete", objListen);
flvPlayback.play(arrMovies[nCurrentMovie]);


This should do the trick. Just place the movie paths into the array called arrMovies and make sure your FLVPlayback component is named flvPlayback. I haven't tested this, just kinda wrote it on a whim, but it looks like it should be fine.

Kevpool1
09-07-2006, 11:29 PM
Mrand01, thank you for taking the time to help me. The code works perfectly.

Thanks again.