开发者

Hidding a Flash SWF upon loading

开发者 https://www.devze.com 2023-01-02 14:48 出处:网络
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):

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/getflash开发者_开发知识库player"
);

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


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号