【问题标题】:How can I remove a swf file that's embedded in html using a button in the swf?如何使用 swf 中的按钮删除嵌入在 html 中的 swf 文件?
【发布时间】:2008-11-13 21:44:13
【问题描述】:

我有一个嵌入在 html 页面中的 swf 文件,并且我在 swf 页面中有一个关闭按钮,我希望当我单击该按钮时 swf 消失,最好的方法是什么?谢谢。

【问题讨论】:

    标签: html flash embed


    【解决方案1】:

    如果您使用 swfobject 2.1 来嵌入 swf,您可以使用这个内置的 javascript swfobject.removeSWF() 函数:

    function removeFlashFromHTML() 
    {
     swfobject.removeSWF("id_of_your_html_object");
    }
    

    现在您使用 ExternalInterface 从 Flash 调用 javascript 函数:

    function buttonClicked(evt:MouseEvent) 
    {
     if (ExternalInterface.available) {
      ExternalInterface.call("removeFlashFromHTML()");
     }
    }
    

    有关 SWFObject 的更多信息,请查看this 网站

    【讨论】:

      【解决方案2】:

      编写一个隐藏 swf 或其包含元素的 JavaScript 函数,并通过 swf 本身的“关闭按钮”调用该函数。

      【讨论】:

        【解决方案3】:

        Heres一篇关于如何让flash调用你页面上的一些JS的文章。如果你不想让它回来(隐藏后),我建议你remove it from the DOM 释放资源,因为闪存在客户端环境中很昂贵。

        【讨论】:

        • 删除包含 swf 的 html sn-p 会停止 Flash 播放器插件?
        猜你喜欢
        • 2016-05-01
        • 2010-09-13
        • 1970-01-01
        • 2012-10-23
        • 1970-01-01
        • 2011-08-08
        • 2012-08-15
        • 2012-04-14
        • 2012-11-03
        相关资源
        最近更新 更多