<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head>
<body>
<div id="swfcontain" style="border:3px solid #ccc;width:781px;height:100px;"></div>
<br /> <br />
<table cellpadding=0 cellspacing=0 width=600 style="margin:0px;padding:0px">
<caption style="height:30px;line-height:30px;text-align:center;"><strong>--播放信息--</strong></caption>
<tr><td width=90 align="right" height="23">当前Flash:</td><td><input size="50" readonly id="curFlash" value=""></td>
<tr><td align="right" height="23">总帧数:</td><td><input size=50 value="" id="totalFrames" readonly></td></tr>
<tr><td align="right" height="23">当前帧:</td><td><input size=50 readonly id="curFrame" value=""></td></tr>
<tr><td align="right" height="23">播放状态:</td><td><input size=50 readonly id="playStatu" value=""></td></tr>
<tr><td align="right" height="23">Flash列表:</td><td><select id="flashList" onchange="setMovie(this.selectedIndex)">
</select></td></tr>
</table>
<script type="text/javascript">
<!--
var flashs=[
"s1.swf",
"s2.swf"
];
function makeFlashStr(url){
return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="781" height="100" id="swf">\
<param name="bgcolor" value="#ffffff">\
<param name="movie" value="'+url+'">\
<param name="quality" value="high">\
<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed></object>';
}
var curFlash=0;
var flashLen=flashs.length;
var $=function(obj){return document.getElementById(obj)}
//判断是否需要播放下一个flash
function updateMovie(){
var swf=$("swf");
var swf_container=$("swfcontain");
if(swf.PercentLoaded()==100){
var totalFrames;
//IE与标准浏览器的差别
try{ //For Opera/FF
totalFrames=swf.TotalFrames();
}catch(e){ //For IE
totalFrames=swf.TotalFrames;
}
var curFrame=swf.CurrentFrame()+1;
var isPlay=swf.IsPlaying();
if(totalFrames==curFrame){
swfcontain.innerHTML=makeFlashStr(flashs[++curFlash%flashLen]);
$("flashList").selectedIndex=curFlash;
}
//调试信息
$("curFlash").value=flashs[curFlash%flashLen];
$("totalFrames").value=totalFrames;
$("curFrame").value=curFrame;
$("playStatu").value=(isPlay?"播放中"+[".","..","..."][parseInt(curFrame/10)%3]:"停止");
}else{
//调试信息
$("curFlash").value=flashs[curFlash%flashLen];
$("totalFrames").value="Loading Flash";
$("curFrame").value="Loading Flash";
$("playStatu").value="Loading Flash";
}
setTimeout("updateMovie()",100);
}
//手工指定要播放的flash
function setMovie(index){
curFlash=index;
$("swfcontain").innerHTML=makeFlashStr(flashs[index]);
}
window.onload=function(){
var sel=$("flashList");
//初始化并生成flash列表
for(var i=0;i<flashLen;i++){
$("flashList").add(new Option(flashs[i],i));
}
setMovie(0); //播放第一个flash
//循环检测并更新flash
setTimeout("updateMovie()",10);
}
setMovie('0');
//-->
</script>
</body>
</html>
- 1
- 2
前往页