如何获得swf文件中的总帧数?

时间:2012-12-07 08:29:19

标签: html flash swfobject

  

我将ppt转换为swf格式,所以我需要找到该swf文件中的总帧数,如何获取它?以及如何进入给定swf文件的最后一帧?。

     

示例:这里我给了goto provious和next frame的源代码,但是我还没有得到第一帧,我怎么能得到它?有什么解决方案可以指导我...

     

在这里我怎样才能获得总帧数?请详细解释...先谢谢...

<html>
<head>
<script language="JavaScript">

function getFlashMovieObject(myFlashMovie)
{
if (window.document[myFlashMovie]) 
{
return window.document[myFlashMovie];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[myFlashMovie])
  return document.embeds[myFlashMovie]; 
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}
}

//for Previous frame.....
function PrevFrameFlashMovie()
{ 
var flashMovie=getFlashMovieObject("myFlashMovie");
var currentFrame=flashMovie.TGetProperty("/",4);
var nextFrame=parseInt(currentFrame);
var prevfram =nextFrame-4;
flashMovie.GotoFrame(prevfram);
flashMovie.Play();
}

//for Next frame.....
function PlayFlashMovie()
{
var flashMovie=getFlashMovieObject("myFlashMovie");
flashMovie.Play();
//embed.nativeProperty.anotherNativeMethod();
}

</script>
</head>

<body>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="595" HEIGHT="460" id="myFlashMovie" style="background:#fff;">
<PARAM NAME=movie VALUE="/file.swf"><PARAM NAME=quality VALUE=autolow >

<EMBED src="/file.swf" quality="autolow" wmode="transparent"  autoplay="false" WIDTH="595" HEIGHT="460" NAME="myFlashMovie" ALIGN="middle" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" style="background: none repeat scroll 0 0 #FFFFFF;"></EMBED>
<PARAM NAME=wmode VALUE=transparent><param name="allowScriptAccess" value="sameDomain"/>     <param value="false" name="autoplay" /><param name="allowFullScreen" value="True" />

</OBJECT>




<input type="button" onClick="PrevFrameFlashMovie();" value="PreviousFrame" name="Previous"> 

<input type="button" onclick="PlayFlashMovie();" name="Play" value="NextFrame >>"> 

</body>
</html>

1 个答案:

答案 0 :(得分:2)

加载SWF后,您可以使用 _totalframes 属性获取total_no_of_frmaes。

var totalFrames=flashMovie._totalframes