Adding my own play and progress bar to a video playlist.
There are a couple of things I’m trying to do.
1. Get away from using flash’s skin and use my own play and stop buttons progress bar.
2. Be able to use an autoplay within the script and not use the parameters autoplay.
This is the code I’m using which is working fine. I just want to be able to have more control by being able to write code for the above activities.
package {
import flash.display.Sprite;
import flash.events.Event;
import fl.video.FLVPlayback;
import fl.controls.List;
import flash.text.TextFormat;
import com.flashsupport.video.Playlist;
import com.flashsupport.video.BackgroundBox;
import com.flashsupport.video.Thumbnail;
public class PlaylistThumbnails extends Sprite {
private var pl:Playlist;
private var fp:FLVPlayback;
private var vl:List;
private var labelFormat:TextFormat;
public var xmlURL:String = "../data/animals_thumbnails.xml";
public function PlaylistThumbnails(){
init();
}
private function init():void {
labelFormat = new TextFormat();
labelFormat.font = "Arial";
labelFormat.size = 9;
vl = videoList;
vl.setStyle("textFormat", labelFormat);
vl.setStyle("cellRenderer", Thumbnail);
vl.rowHeight = 48;
vl.addEventListener(Event.CHANGE, onItemClick);
fp = flvPlayer;
fp.addEventListener(Event.COMPLETE, onClipDone);
var bg:BackgroundBox = new BackgroundBox(fp, 0x000000);
pl = new Playlist();
pl.addEventListener(Event.COMPLETE, onListReady);
pl.addEventListener(Playlist.SELECT_LIST_ITEM, onListItemSelect);
pl.load(xmlURL);
}
private function onListReady(e:Event):void {
var pl:Playlist = e.currentTarget as Playlist;
for(var i:int = 0; i < pl.length; ++i){
var item:Object = pl.getItemAt(i);
var listItem:Object = {
label: item.label
};
if(item.thumbnail != null){
listItem.thumbnailSrc = item.thumbnail;
}
vl.addItem(listItem);
}
}
private function onItemClick(e:Event):void {
var list:List = e.currentTarget as List;
pl.selectedIndex = list.selectedIndex;
}
private function onListItemSelect(e:Event):void {
var pl:Playlist = e.currentTarget as Playlist;
vl.selectedIndex = pl.selectedIndex;
fp.source = pl.selectedItem.src;
}
private function onClipDone(e:Event):void {
if(pl.selectedIndex < pl.length - 1){
pl.selectedIndex++;
} else {
pl.selectedIndex = 0;
}
}
}
}
I would appreciate if someone can show me how to implement putting my own play stop and progress bar and get away from using flash's skin and autoplay parameters.
Thanks