Since version 8, Flash has continued to include a wicked import video feature which allows anybody to compress AVI’s to FLV’s and control the output using a standard web video player format. Also provided are a few different skins for the author to choose from. This component is very quick and useful and above all, almost anyone can use it, not just a web designer.
I was recently asked about “doing something” after a FLV has finished playing is Flash 8 (Actionscript 2), and I realised, hmmm….
I have never actually needed to do that before.
So I decided to look into it, turns out it is actually really simple. Just run through the whole importing a video process (making sure it is a “progressive stream from the webserver”) and give your video component an instance name; in this case we’ll call it videoPlayer.
Next, create your new actions layer and add the following code to it:
stop();
var listener:Object = new Object();
listener.complete = function(evt:Object):Void {
//DO ACTIONS HERE
}
videoPlayer.addEventListener(”complete”, listener);
That’s it! It’s that simple and you can make it do whatever you like.
Some more useful things to know are the following:
//This code displays the state of the video. E.g stopped
trace(evt.state);
//This code displays entire video’s length.
trace(evt.playheadTime);
Click here to view a fully working example or here to download it instead.