简体   繁体   English

加载时隐藏Flash SWF

[英]Hidding a Flash SWF upon loading

I have a question that is probably very simple, but I cannot find an answer here or on Google. 我有一个可能很简单的问题,但是在这里或在Google上找不到答案。

I am loading a SWF in an HTML page the following way (using JavaScript): 我通过以下方式(使用JavaScript)在HTML页面中加载SWF:

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

I have tried to add the line: 我尝试添加以下行:

"style", "visibility: hidden"

But it has not worked. 但这没有用。 I can later on make it visible or hidden using: 我可以稍后使用以下方法使其可见或隐藏:

document.getElementById("flash").style.visibility = "hidden";

But I would like to have the flash invisible and make it visible later on, but by adding a parameter in the AC_FL_RunContent. 但是我想使闪光灯不可见,并稍后使它可见,但是要在AC_FL_RunContent中添加一个参数。

I hope someone can please help me. 我希望有人可以帮助我。 Thanks a lot. 非常感谢。

Rudy 鲁迪

Rudy, we will need to see the function AC_FL_RunContent(){...}. 鲁迪,我们将需要查看函数AC_FL_RunContent(){...}。 You can't pass in any old parameter you like into a function. 您不能将任何喜欢的旧参数传递给函数。 It has predefined parameters. 它具有预定义的参数。 If visiblity is one of them then it should work. 如果可见性是其中之一,那么它应该起作用。 if not, you will need to add a parameter that will hide the element. 如果不是,则需要添加一个隐藏元素的参数。

Also, a better way of hiding an element is with display: none. 另外,隐藏元素的更好方法是使用display:none。

So maybe you would create a parameter for the funciton and call it, hideOnLoad. 因此,也许您将为功能创建一个参数并将其命名为hideOnLoad。 You would then pass Boolean true in for the param. 然后,您可以将布尔值true传递给参数。 Then do something like this and put it after the flash element is injected: 然后执行以下操作,并将其放入Flash元素后:

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

Or see where the object for "flash" is created and add .style.display: 'none'. 或者查看在何处创建“ flash”对象并添加.style.display:'none'。 Or if the object is already in the DOM in the beggining, just add style="display: none" to the HTML element. 或者,如果对象在开始时已经在DOM中,则只需向HTML元素添加style =“ display:none”。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM