【问题标题】:How to include swf file on a page如何在页面上包含 swf 文件
【发布时间】:2014-06-09 18:52:39
【问题描述】:

我想知道我是否有很多swf格式的游戏,我希望它们嵌入到html中,这样做的标签是什么?

<object width="100%" height="100%">
    <param name="movie" value="file.swf">
    ..
    <embed src="intro.swf" width="100%" height="100%" />
</object>

【问题讨论】:

标签: html flash swfobject swfupload swfloader


【解决方案1】:

如果您有 sample.swf 文件,以下是示例代码

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="50" height="50" id="FlashID" title="sample">
  <param name="movie" value="sample.swf" />
  <param name="quality" value="high" />
  <param name="wmode" value="opaque" />
  <param name="swfversion" value="6.0.65.0" />
  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
  <param name="expressinstall" value="Scripts/expressInstall.swf" />
  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
  <!--[if !IE]>-->
  <object type="application/x-shockwave-flash" data="sample.swf" width="50" height="50">
    <!--<![endif]-->
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="swfversion" value="6.0.65.0" />
    <param name="expressinstall" value="Scripts/expressInstall.swf" />
    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
    <div>
      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
    </div>
    <!--[if !IE]>-->
  </object>
  <!--<![endif]-->
</object>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>

您还需要在下面包含 JavaScript 文件 http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js

【讨论】:

  • swfobject 不仅仅是 JavaScript 的一部分,你不能在不嵌入库的情况下调用它。 标记的大部分功能已从 HTML 4 到 5 中删除。它仍然可以使用,但不推荐使用。总而言之,一个非常糟糕的答案
猜你喜欢
  • 1970-01-01
  • 2012-04-14
  • 2015-05-11
  • 2016-09-18
  • 1970-01-01
  • 2010-09-13
  • 1970-01-01
  • 2010-10-24
  • 1970-01-01
相关资源
最近更新 更多