FLVPlayback - Load new flv when flv finishes

I have a swf movie with an FLVPlayback component, which at startup has an flv loaded into it.

Can anyone tell me the actionscript that will load and play another movie when the first one finishes?
LVL 3
Mr_SplashAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

julianopolitoCommented:
name your flvplayback component as "flvp" (no quotes)

then in first frame

var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
    flvp.load("other.flv");
    trace("loading other flv");
};
//Register a listener object so it is executed when movie finishes playing
flvp.addEventListener("complete", listenerObject);
0
Mr_SplashAuthor Commented:
Thanks juilianopolito,

I can't seem to get it to work. I've put the as below exactly as it is in my movie. (the initial movie is defined in the parameters) Any idea where I'm going wrong?

Also is it possible to loop the second movie?


var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
    cb_player.load("/assets/videos/home-video-loop.flv");
    trace("loading other flv");
};
 
cb_player.addEventListener("complete", listenerObject);

Open in new window

0
julianopolitoCommented:
try this
var listenerObject:Object = new Object();
var thisObj = this;
listenerObject.complete = function(eventObject:Object):Void {
    thisObj.cb_player.load("/assets/videos/home-video-loop.flv");
    trace("loading other flv");
};
 
cb_player.addEventListener("complete", listenerObject);

Open in new window

0
julianopolitoCommented:
for the second question, to loop the second video:
var listenerObject:Object = new Object();
listenerObject.complete = function(e:Object):Void {
    //Also you can use e.target to access the object that generated the event
    //instead of the thisObj approach I shown you above
    e.target.load("/assets/videos/home-video-loop.flv");
    e.target.removeEventListener("complete", listenerObject);
    var list:Object = {};
    list.complete = function(e:Object){
         trace("playing again second movie");
         e.target.play();
    }
    e.target.addEventListener("complete", list);
 
    trace("loading other flv");
};
 
cb_player.addEventListener("complete", listenerObject);

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.