js控制显示flash的加载进度条显示百分比代码
效果截图如下
	
附带js加载显示flash代码,也可以显示广告或图片、flash等。。。
| 
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js控制显示flash的加载进度条显示百分比代码</title>
</head>
<style>
*{padding:0px; margin:0px;}
body{text-align:center; background:#2f200a;}
</style>
<body>
<div id="flash_body" style="display:none;">
<object id='pageLodimgFlash' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="1024" height="768">
  <param name="movie" value="http://www.songhelin.cn//skins/default/indexflash/index.swf" />
  <param name="quality" value="high" />
  <embed src="http://www.songhelin.cn/skins/default/indexflash/index.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1024" height="768"></embed>
</object>
</div>
<div id="flash_img_loading" style="padding-top:250px; "><img src="loading.gif" /><br/></div>
<div id="flash_loading" style="padding-top:10px; color:#090; font-size:18px;"></div>
<script language="javascript" type="text/javascript">
/**
* 在IE中可用不着PercentLoaded()方法获取SWF的下载进度,在firefox中怎么获取?
*/
var ie = /*@cc_on!@*/false;
var movie = ie && window["game_flash4"] || document["welcome"];
//setInterval("document.title='Flash加载中,已经加载了'+ani_GetFlashState('loaded')+'/100';",100);
setInterval("flash_body_f(ani_GetFlashState('loaded'))",100);
function flash_body_f(loading_count){
	if(loading_count>=100){
		var obj = document.getElementById('flash_body');
		var obj_load = document.getElementById('flash_loading');
		var obj_load_img = document.getElementById('flash_img_loading');
		
		obj_load_img.style.display='none';
		obj.style.display = 'block';
		obj_load.innerHTML = '';
	}else{
		var obj 	 = document.getElementById('flash_body');
		var obj_load = document.getElementById('flash_loading');
		obj.style.display='none';
		obj_load.innerHTML = '网站加载中,已经加载了'+loading_count+'%...';
	}
	
}
function ani_GetFlashState(v)
{/* 获得当前FLASH的状态值[v=loaded(当前下载状态),v=current(当前播放针数),v=total(总播放针数)] */
if(ie)
{
if(v=='loaded')                        return document.getElementById('pageLodimgFlash').PercentLoaded();
else if(v=='current')        return document.getElementById('pageLodimgFlash').CurrentFrame();
else if(v=='total')                return document.getElementById('pageLodimgFlash').TotalFrames;
}
else
{
if(v=='loaded')                        return window.document.pageLodimgFlash.PercentLoaded()
else if(v=='current')        return window.document.pageLodimgFlash.CurrentFrame();
else if(v=='total')                return window.document.pageLodimgFlash.TotalFrames();
}
}
</script>
</body>
</html>
 | 


