测试的时候在同目录下创建个“flv”文件夹,把要播放的视频文件放到里面,当然,相对应的playlist.xml也要修改一下。
?
//==========视频初始化======================
var?nc:NetConnection?=?new?NetConnection();
nc.connect(null);
var?ns:NetStream?=?new?NetStream(nc);
my_video.attachVideo(ns);
ns.setBufferTime(5);
//=====从xml文件中获得待播放视频的各种信息====
data_xml?=?new?XML();
data_xml.ignoreWhite?=?true;
data_xml.onLoad?=?loadData;
data_xml.load("playlist.xml");
var?aPath?=?new?Array();
temp?=?0;
function?loadData(success)?{
if?(success)?{
??//获得所有的文件名称
??songTitel?=?new?Array();
??audioTracks?=?this.firstChild.childNodes;
??song_total?=?audioTracks.length;
??for?(var?i?=?0;?i=?0){
??ns.seek(p*dur);
??ns.pause(true);
??prog_mc._xscale?=?p*100;
??}
}
function?videoUpdate()?{
var?prog?=?ns.time/dur;
prog_mc._xscale?=?prog*100;
playlab_mc._x?=?7.5?+?prog*334.9;
var?lprog?=?ns.bytesLoaded/ns.bytesTotal;
lprog_mc._xscale?=?lprog*100;
}
//=========声音控制=============
vidsound.attachAudio(ns);
var?sou:Sound?=?new?Sound(vidsound);
sou.setVolume(75);
SC_mc.onPress?=?function?(){
this.onEnterFrame?=?setV;
}
SC_mc.onRelease?=?SC_mc.onReleaseOutside?=?function?(){
delete?this.onEnterFrame;
}
function?setV?(){
if(_root._ymouse?>=?275?&&?_root._ymouse?
本文转自:http://www.5uflash.com/flashjiaocheng/Fmsjiaocheng/2381.html