使用javascript获取flash加载的百分比的实现代码
作者:
使用javascript获取flash加载的百分比的实现代码,方便flash小游戏判断页面,提高用户体验。
复制代码 代码如下:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>flash download</title>
</head>
<body>
<object id="movie" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="750" height="563" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://www.crown-golf.com.cn/games/Golf4.swf" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffcc33" />
<embed src="http://www.crown-golf.com.cn/games/Golf4.swf" menu="false" quality="high" bgcolor="#ffcc33" width="750" height="563" name="movie" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object><br>
<button onClick="alert(movie.PercentLoaded()==100 ? '下载完成' : '已经下载百分比: ' + movie.PercentLoaded())">PercentLoaded</button>
</body>
</html>