muudless
muudless

Reputation: 7532

How to do something after video finishes?

I have a 15 second video that's not embedded (it's sourced from an url). How can I get it to play the next frame when then video is finished?

Upvotes: 1

Views: 1437

Answers (2)

Matthias
Matthias

Reputation: 7521

If you are using the FLVPlayback component, you can do it like this:

// for clarification
var video:FLVPlayback = myVideoInstance;

video.source = "http://example.com/myvideo.flv";
video.autoPlay = true;
video.addEventListener(VideoEvent.COMPLETE, function(e:VideoEvent) {
    // video has finished
});

Upvotes: 1

Marty
Marty

Reputation: 39456

See VideoEvent.COMPLETE which is dispatched when a video has finished playing.

video.addEventListener(VideoEvent.COMPLETE, _doNext);
function _doNext(e:VideoEvent):void
{
    video.removeEventListener(VideoEvent.COMPLETE, _doNext);
    trace("video done, what's next?");
}

Upvotes: 0

Related Questions