views:

54

answers:

2

Hello,

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

A: 

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.

Dale
Thanks a lot! I have issue with display: none. It works fine in IE, but in FF it also disables the Flash (or actually, I cannot call Flash from JavaScript anymore, which is a big issue).Thanks a lot though, I like your way of adding a parameter. Works great. Thanks a lot!
Rudy
Forgive me, there is actually an issue with that approach. More than hiding the flash, it actually disabled it. I need it only to be hidden, but still work behind the scene. Do you please have an idea?
Rudy
Does it work then to just do visibility='hidden';? If not try wrapping the flash in a div and hide the div.
Dale
For some reason, visibility='hidden' hides the Flash but does not disable it, except if I call it before it loaded.I tried the div (and I think it's actually a very good idea). I am having issues with it though. For some reason this approach seems to stop Flash from operating. By that, I mean I added a breakpoint in my flash constructor, and while the style="display: none;" is on, it own't execute.
Rudy
My goal here, to make it more clear, is to hide the flash application when it is loaded. Flash will then check the flashVars, and if there are correct, use the ExternalInterface to call JavaScript and tells it to make Flash visible/available to the user.Thank you for your help.
Rudy
Have you tried visiblity: hidden on the div? Just put style="visiblity: hidden;" right on the div in the HTML.
Dale
I have tried that. It actually has the same effect has making the flash invisible: it also stops the flash from loading, or unloads it.
Rudy
How about this. Make the containing div relative, then make a div inside him that is position absolute; width: 100%; height:100% and make the color match your background. He will cover it in the beginning, then hide him after the flash loads.
Dale
Thank you for your help.I am not sure I got this right. Should it please be:<div style="position: relative;"> <div id="flash_uploader" style=" position: absolute; width: 100%; height: 100%;">and then make the visibility of id=flash_uploader to hidden once flash has loaded? It seems that when it's not hidden, I can still interact with flash, it is still visibile.Thanks for helping.
Rudy
A: 
<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>
Dale
Thank you so much! This works extremely well, this is great, thank you again! Sorry it took so long for me to get it working.
Rudy
Not a problem, you are welcome!
Dale