-
create chapters in an FLV like a DVD
Since flash doesn’t have anything built into it for setting chapters or in and out points in an flv, I thought I would take it upon myself to figure it out.
Here is what I came up with:
1. Add an instance of the FLVPlayback component to your stage and give it an instance name of “flv” - catchy, hey?
2. add the following actionscript to the first frame of your timeline
var listenerObject:Object = new Object();
var curTime;
function playChapter (startSecond:Number, endSecond:Number) {
listenerObject.playheadUpdate = function (eventObject:Object):Void {
curTime = flv.playheadTime;
trace(curTime);
if (curTime>=endSecond) {
flv.pause();
}
}
flv.seekSeconds(startSecond);
flv.play();
}
flv.addEventListener("playheadUpdate",listenerObject);3. link the instance of your FLVPlayback component to an flv of your choice.
4. create chapter buttons on the stage
5. place this code on the buttons
on(release){
playChapter(2,5); //change these numbers to your start time and stop time, in seconds
}**Note** Make sure you encode your FLV with at least a keyframe every 1 second otherwise you won’t be able to start and stop at the correct times. For this example I have it keyframe every 15 frames, cause the video plays 15fps.
Good Luck!


