加载时隐藏Flash SWF

时间:2010-06-09 00:10:43

标签: javascript flash

我的问题可能非常简单,但我无法在此处或在Google上找到答案。

我正在通过以下方式在HTML页面中加载SWF(使用JavaScript):

AC_FL_RunContent(
    "src", "${swf}",
     ....
    "type", "application/x-shockwave-flash",
    "pluginspage", "http://www.adobe.com/go/getflashplayer"
);

我试图添加一行:

"style", "visibility: hidden"

但它没有奏效。我可以稍后使用:

使其可见或隐藏
document.getElementById("flash").style.visibility = "hidden";

但是我希望闪光灯不可见并让它在以后可见,但是通过在AC_FL_RunContent中添加一个参数。

我希望有人可以帮助我。 非常感谢。

鲁迪

2 个答案:

答案 0 :(得分:0)

鲁迪,我们需要看到函数AC_FL_RunContent(){...}。您不能将任何您喜欢的旧参数传入函数。它有预定义的参数。如果visiblity是其中之一,那么它应该工作。如果没有,您将需要添加一个隐藏元素的参数。

另外,隐藏元素的更好方法是使用display:none。

所以也许你会为funciton创建一个参数并调用它,hideOnLoad。然后,您将为param传递布尔值true。然后做这样的事情,并在注入flash元素后放置它:

if (hideOnLoad) document.getElementById("flash").style.display= "none";

或者查看创建“flash”对象的位置并添加.style.display:'none'。或者如果对象已经在开始的DOM中,只需将style =“display:none”添加到HTML元素中。

答案 1 :(得分:0)

<div style="position:relative;"><!-- this is a wrapper so that the cover will site directly over the flash. -->
   <div id="flash_uploader"></div><!-- this represents your flash, it is always visible -->
   <div id="flashCover" style="position:absolute; background: #fff; width: 100%; height: 100%; top: 0; left: 0;"></div><!-- this covers the flash until the flashvars are correct, hide it in your function when the flashvars are correct. -->
</div>