HTML 控制播放SWF格式

这篇博客展示了如何使用HTML中的JavaScript函数来控制SWF格式的电影播放。通过`<input>`按钮触发`startMovie()`、`stopMovie()`、`rewindMovie()`和`displayFrameCount()`等函数,实现播放、停止、倒退和显示帧数等功能。这些函数通过`document.getElementById("index")`获取SWF对象并调用其方法进行操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!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=gb2312" />

<title>微蓝</title>

</head>

<script type="text/javascript">

<!--  

            function startMovie() {  

                var oFlashMovie = document.getElementById("index");  

                oFlashMovie.Play();  

            }  

 

            function stopMovie() {  

                var oFlashMovie = document.getElementById("index");  

                oFlashMovie.StopPlay();  

            }  

 

            function rewindMovie() {  

                var oFlashMovie = document.getElementById("index");  

                oFlashMovie.Rewind();  

            }  

 

            function displayFrameCount() {  

                var oFlashMovie = document.getElementById("index");  

 

                if (typeof oFlashMovie == "function") {  

                    alert("There are " + oFlashMovie.TotalFrames() + " frames in the movie.");  

                } else {  

                    alert("There are " + oFlashMovie.TotalFrames + " frames in the movie.");  

                }  

            }  

 

            function displayIsMoviePlaying() {  

                var oFlashMovie = document.getElementById("index");  

 

                if (oFlashMovie.IsPlaying()) {  

                    alert("The movie is playing.");  

                } else {  

                    alert("The movie is stopped.");  

                }  

            }  

 

 

//-->

</script> 

<body>

<center>

  <table width="731" height="704" bgcolor="#CCCCCC">

    <tr>

      <td width="721" height="451" align="center" valign="middle"><p></p>

        <table width="100%" height="44" bgcolor="#CCCCCC">

          <tr>

            <td width="100%" height="38" align="center"><span class="STYLE15">海南省万宁市大茂镇赖氏木材拼板厂</span></td>

          </tr>

        </table>

 

<object type="application/x-shockwave-flash" data="index.swf" width="400" height="400" id="index">  

          <param name="movie" value="index.swf"/>  

          <param name="quality" value="high" /><!--将flash的清晰度设为高-->  

          <param name="menu" value="false" /><!--将flash的右键菜单隐藏-->  

          <param name="wmode" value="transparent" /><!--设置flash背景透明-->  

       </object>  

        <p>  

        <input type="button" value="Play" onclick="startMovie()" />  <br/>

        <input type="button" value="Stop" onclick="stopMovie()" />   <br/>

        <input type="button" value="Rewind" onclick="rewindMovie()" />   <br/>

        <input type="button" value="How Many Frames?" onclick="displayFrameCount()" />  <br/> 

        <input type="button" value="Is Movie Playing?" onclick="displayIsMoviePlaying()" />  

</td>

    </tr>

      </table></td>

    </tr>

  </table>

</center>

</body>

</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值