//flashID:需要插入flashID
//elm:需要插入flash的外层HTMLElement
//url: flash的地址
//w: flash宽
//h: flash高
//wmode: 背景是否透明 transparent
function insertFlash(flashID,elm, url, wmode, w, h) {
if (!document.getElementById(elm)) return;
var str = '';
str += '<object id="'+flashID+'" width="'+ w +'" height="'+ h +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=";
str += '<param name="movie" value="'+ url +'">';
str += '<param name="wmode" value="'+ wmode +'">';
str+='<param name="menu" value="false">';
str += '<embed width="'+ w +'" height="'+ h +'" src="'+ url +'" quality="autohigh" wmode="opaque" type="application/x-shockwave-flash" plugspace="" menu="false></embed>';
str += '</object>';
document.getElementById(elm).innerHTML = str;
}
function loadFlash(flashID,elm,url,wmode,w,h,onupdata,onload)
{
insertFlash(flashID,elm,url,wmode,w,h);
var CheckFlashStatus=function()
{
var total= ani_GetFlashState(flashID,"loaded");
if(total<100)
{
onupdata(total);
}
else
{
onload();
clearInterval(flashtimer);
}
}
var flashtimer=setInterval(CheckFlashStatus,10);
}
function ani_GetFlashState(FlashObjectID,v)
{
var ie = ;
var FlashObject=$ID(FlashObjectID);
/* 获得当前FLASH的状态值[v=loaded(当前下载状态),v=current(当前播放针数),v=total(总播放针数)] */
if(ie)
{
if(v=='loaded')
return FlashObject.PercentLoaded();
else if(v=='current')
return FlashObject.CurrentFrame();
else if(v=='total')
return FlashObject.TotalFrames;
}
else
{
return 100;
}
}