在 html 中重置 Flash 游戏

Resetting flash game in html

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="200" id="FlashID" title="Tank-Trouble"> <param name="movie" value="TankTrouble_v3.8c.swf"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="swfversion" value="8.0.35.0"> <param name="expressinstall" value="Scripts/expressInstall.swf"> <object type="application/x-shockwave-flash" data="TankTrouble_v3.8c.swf" width="800" height="475"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="swfversion" value="8.0.35.0"> <param name="expressinstall" value="Scripts/expressInstall.swf"> <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> </object> </object> 我刚接触HTML,接到了制作网站的任务。我正在使用 Dreamweaver CS6 制作这个网站,并使用插入媒体选项将我下载到计算机上的“.swf”游戏放入其中。现在,我的问题是,是否有任何方法可以使用 JavaScript 或 jQuery 重置该游戏?我希望游戏在按下按钮时返回到它的标题屏幕。我已经把我用来放flash游戏的代码贴在文档里了。

如有任何帮助,我们将不胜感激!

正如 Gurtej Singh 所指出的,如果您无法访问 .sfw 文件的源代码,您唯一的选择是将其重新加载到 DOM.

假设您将 Flash 对象放置在“flashContent”容器中并且您有一个“refreshSwf”元素...

<div id="flashContent">
    <object ...>
        ...
    </object>
</div>

<div id="refreshSwf">Refresh game</div>

...您可以按以下方式使用 jQuery:

<script>
    $( document ).ready(function() {
        $("#refreshSwf").click(function(){$("#flashContent").html($("#flashContent").html());});
    });
</script>

希望对您有所帮助。祝你好运!