简体   繁体   中英

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.

I am loading a SWF in an HTML page the following way (using JavaScript):

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.

I hope someone can please help me. Thanks a lot.

Rudy

Rudy, we will need to see the function 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.

So maybe you would create a parameter for the funciton and call it, hideOnLoad. You would then pass Boolean true in for the param. Then do something like this and put it after the flash element is injected:

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

Or see where the object for "flash" is created and add .style.display: 'none'. Or if the object is already in the DOM in the beggining, just add style="display: none" to the HTML element.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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