javascript - 在 html 中重置 Flash 游戏

标签 javascript html flash

<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>

希望有帮助。祝你好运!

关于javascript - 在 html 中重置 Flash 游戏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32154206/

相关文章:

javascript - IE中的CSS翻转动画: Turned side shows mirror content

javascript - 一张 D3 图上有多个文件

javascript - axios:onUploadProgress 事件仅在视频完全上传后触发

html - 设置 Bootstrap 下拉菜单的起点

html - 我的网站根本不会滚动

.net - 使用 Flash 或 .NET 以移动图像作为叠加层的视频

javascript - 如何获取对象的属性名称并在javascript中使用该属性名称

javascript - 将上下文传递给函数 [Javascript 图形]

html - 为什么我的 Flash 动画覆盖了我的 div 位置?

Jquery动态更改flashparam属性(config = {"playlist": ["url"] :"http://localhost/test.flv"}) of an embed tag