Flash加载两次解决方法? [英] Flash loads twice workaround?

查看:178
本文介绍了Flash加载两次解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的网站缓慢加载调查报告的问题时,我遇到了一个问题,我注意到(通过萤火虫)我的Flash文件加载两次。

有点调查我跟踪到一个 Firefox的错误结合使用SWFObject 2.0。

现在,我注意到在线程中有人提到你可以通过以下方法解决问题:

< blockquote>

仅供参考,如果您是网页开发人员,那么简单的解决方法是让页面
与FF3一起工作,就是延迟访问任何插件,直到页面满载
。执行此操作的简单方法是使用window.setTimeout以超时
为零的方式安排插件脚本代码
在所有未决浏览器事件之后运行。


老实说,我不知道他们在说什么,希望有人能给我一个代码示例,将工作。

你知道一个方法来做这个工作,代码会是什么样子?任何帮助将非常感激!

解决方案

 < script> 
函数loadswf()
{
swfobject.registerObject(myobj,9.0.0);

函数init()
{
window.setTimeout(loadswf(),0);
}
< / script>
< body onload =init()>

< object classid =clsid:D27CDB6E-AE6D-11cf-96B8-444553540000width =778height =198id =myobj>
< param name =movievalue =style.swf>
< param NAME = FlashVars VALUE =url = {{stylelist}}>
<! - [if!IE]> - >
< object type =application / x-shockwave-flashdata =style.swfwidth =778height =198>
< param name =flashvarsvalue =url = {{stylelist}}>
<! - <![endif] - >

< a href =http://www.adobe.com/go/getflashplayer>
< img src =http://www.adobe.com/images/shared/download_buttons/get_flash_player.gifalt =Get Adob​​e Flash player/>
< / a>
<! - [if!IE]> - >
< / object>
<! - <![endif] - >
< / object>


While investigating a reported problem with my site loading slowly, I came across an issue where I noticed (via firebug) that my flash file was loading twice.

After a bit of investigation I tracked it down to a firefox bug combined with the usage of SWFObject 2.0.

Now, I noticed on the thread that someone mentioned that you can workaround the problem by:

FYI, if you're a webpage developer then an easy workaround to get your page working with FF3 is to delay accessing any plugins until after your page has fully loaded. An easy way to do this is to schedule your plugin scripting code to run after all pending browser events using window.setTimeout with a timeout of zero.

Honestly, I have no clue what they're saying and am hoping someone can give me a code example that will work.

Do you know of a way to make this work and what the code would look like? Any help would be immensely appreciated!

解决方案

<script>
  function loadswf()
  {
     swfobject.registerObject("myobj", "9.0.0");
  }
  function init() 
  {
     window.setTimeout("loadswf()", 0);
  }
</script>
<body onload="init()">

 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="778" height="198" id="myobj">
    <param name="movie" value="style.swf">
    <param NAME=FlashVars VALUE="url={{stylelist}}">
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="style.swf" width="778" height="198">
     <param name="flashvars" value="url={{stylelist}}">
    <!--<![endif]-->

    <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" />
                    </a>
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
 </object>             

这篇关于Flash加载两次解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆