Flash嵌入不起作用

时间:2010-08-02 14:13:09

标签: html embed swfobject

请保存我的皮肤。

http://clubentertainment.ie/c/art-perf/embed_example.html

以上链接应在Firefox中加载,不加载任何内容。似乎没有抛出任何错误。它甚至可以验证。

它正在使用swfobject,所有链接似乎都有效..它实际上并没有起作用。我想责怪flash对象,但因为它在Firefox中工作,错误必须在其他地方。

有什么想法吗?是否有其他方法可以嵌入并仍然有效?

此外,wmode透明度不允许html下拉列表出现在flash的顶部..

不确定赏金会发生什么 - 我发现了问题。错误肯定与服务器有关。移动网站,没有改变任何其他。工作得很好。我要感谢每个人的帮助。

5 个答案:

答案 0 :(得分:2)

我认为这是跨域政策的问题。尝试使用相对路径url而不是绝对路径。你现在有绝对的道路。

答案 1 :(得分:2)

当把直接链接放到你的swf上时,它就可以了。 http://clubentertainment.ie/c/art-perf/CU3ER.swf

这可能是一个跨站点问题。 这里是CU3ER中用于演示http://getcu3er.com/features/

的代码
<script type="text/javascript"> 

                    var vars = { xml_location : '/inc/cu3er/config_features_overview.xml?v=2'};
                    var params = {  wmode:'transparent' };
                    var attributes = { id:'CU3ER', name:'CU3ER' }; // give an id to the flash object

                    swfobject.embedSWF("/CU3ER.swf", "cu3er-container", "300", "390", "9.0.45", "/js/expressInstall.swf", vars, params, attributes );

                </script> 

修改 只是把你的代码放在正文中而不是标题我得到了swf工作,即

    <body >
    <script type="text/javascript">
      // add your FlashVars
      var vars = { xml_location : 'http://clubentertainment.ie/c/art-perf/CU3ER-config.xml' };
      // add Flash embedding parameters, etc. wmode, bgcolor...
      var params = { bgcolor : '#ffffff' };
      // Flash object attributes id and name
      var attributes = { id:'CU3ER', name:'CU3ER' };
      // dynamic embed of Flash, set the location of expressInstall if needed
        swfobject.embedSWF('http://clubentertainment.ie/c/art-perf/CU3ER.swf', "CU3ER", 500, 250, "9.0.45", "http://clubentertainment.ie/c/art-perf/js/expressInstall.swf", vars, params, attributes );
      // initialize CU3ER class containing Javascript controls and events for CU3ER
      // var CU3ER = new CU3ER("CU3ER");
    </script>

  <!-- CU3ER content HTML part starts here   -->
  <div id="CU3ER">
    <noscript>
      <!-- modify this content to provide users without Flash or enabled Javascript with alternative content information -->
      <p>Click to get Flash Player<br /><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></p>
      <p>or try to enable JavaScript and reload the page
      </p>
    </noscript>
  </div>
  <!-- CU3ER content HTML part ends here   -->


</body>

答案 2 :(得分:1)

我发现它在Safari 5中不起作用,但在Firefox 4中工作。请尝试使用SWFObject静态发布方法嵌入,以便排除JavaScript作为潜在问题:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <title>CU3ER</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="/c/art-perf/js/swfobject.js"></script>
    <script type="text/javascript" src="/c/art-perf/js/CU3ER.js"></script>
    <script type="text/javascript">
        swfobject.registerObject("cu3er-container", "9.0.45", "/c/art-perf/js/expressInstall.swf");
    </script>
</head>
<body>
    <div>
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="390" id="cu3er-container" class="CU3ER">
            <param name="movie" value="/c/art-perf/CU3ER.swf" />
            <param name="wmode" value="transparent" />
            <param name="bgcolor" value="#ffffff" />
            <param name="flashvars" value="xml_location=/inc/cu3er/config_features_overview.xml?v=2" />
            <!--[if !IE]>-->
            <object type="application/x-shockwave-flash" data="/c/art-perf/CU3ER.swf" width="300" height="390" class="CU3ER">
                <param name="wmode" value="transparent" />
                <param name="bgcolor" value="#ffffff" />
                <param name="flashvars" value="xml_location=/inc/cu3er/config_features_overview.xml?v=2" />
            <!--<![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>
    </div>
</body>
</html>

您可能需要调整JavaScript以处理“cu3er-container”ID或“CU3ER”类。在此示例中,仅在Flash版本不足时才调用SWFObject,以便它可以提供快速升级的快速安装程序,否则这不需要JavaScript。

答案 3 :(得分:0)

您始终可以尝试使用XHTML中的有效技术嵌入Flash。您可以在此处找到有关此内容的更多信息:http://latrine.dgx.cz/how-to-correctly-insert-a-flash-into-xhtml

至于swfobject,似乎它有一些与浏览器相关的问题。我稍后会尝试解决这个问题。如果我得出任何结论,我会告诉你的。

修改

尝试使用swf文件的相对路径。它对我有用。

答案 4 :(得分:0)

SWF在Chrome 5.0.375.125中正好适合我,但幻灯片显示未加载。我怀疑这可能与不同的Web浏览器如何处理Javascript错误之间的差异有关。

我为Internet Explorer启用了脚本调试(我强烈建议这样做)并打开你的页面,我立即得到了一个Javascript错误,看起来是Flash ExternalInterface调用CU3ER.js中定义的Javascript函数。有时浏览器决定在遇到错误时完全停止运行脚本,有些只是继续。 Firefox处于“只是继续”阵营。当单击“忽略”IE中的错误时,IE能够加载图像但仍然导致Javascript错误。

Javascript错误似乎正在发生,因为CU3ER无法在DOM中找到自己。这是基于发出此Javascript函数调用的事实:

__flash__addCallback(document.getElementById(""), "playCU3ER");

发出的函数定义如下:

function __flash__addCallback(instance, name) {
    instance[name] = function () { 
        return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));
    }
}

使用空字符串调用document.getElementById这一事实可能意味着CU3ER需要一些缺少的flash变量。检查SWF的文档,确保嵌入时需要具备的功能。或者它可能是其他人提到的相对与绝对URL问题。