I have a web page where a flash file is embeded in that.The flash file is having a quiz consist of 4 questions.When user answer the first question the second question will b
The internal $.hide()
method does a css: display:none;
on your element. This will cause the flash to reload each time. I would suggest hiding your flash a different way, since it reacts poorly to this css property.
Here is a plugin that hides your element by positioning it off of the screen. This doesn't work in all cases, but can be very useful if it applies to you.
The CSS to add:
.flashHide {
position:absolute;
left:-99999px;
}
And the plugin to add:
(function($){
var hideClassName = 'flashHide';
$.fn.extend({
flashHide: function() {
return this.each(function(){
$(this).addClass(hideClassName);
});
},
flashShow: function() {
return this.each(function(){
$(this).removeClass(hideClassName);
});
}
});
})(jQuery);
Then you would use it like this:
$('div#flashContainer').flashHide();
$('div#flashContainer').flashShow();
The only solutions which work for me on Firefox and Chrome is these css code on flash container:
If you want "remove" flash from the document (kind of like display:none
):
width:0;
height:0;
If you want only hide element without "remove" from the document:
visibility: hidden
The position tips doesn't work on Chrome
You had many options, but best one is to add flash code into container eq #hiddeflash, inside emended code. Also you need play with your overlay z-index and postion:
/*1*/
visibility:hidden!important;
/*1*/
position:absolute;
left:-300%;
/*3*/
width:0;
height:0;
/*4*/
visibility:hidden!important;
/*5*/
display:none
I know this is an old thread but I wanted to post an easy solution for those looking for one that won't require changes to existing JS code. In my case, I had a an existing Tabset component that was creating new tabs and dynamically loading the html that embedded the SWF.
IMO, the easiest way to handle this is to place an iframe wrapper around the SWF - then it won't shut down/reload when you show/hide the Div container.
To fix this problem, you just have to insert a simple html wrapper file.
Main App -> HTML loader -> SWF file
Main App -> iframe loader -> HTML loader -> SWF file
<iframe src="/stuff/swfContainer.html" style="width:100%;height:100%;border:0px;">
</iframe>
then inside the swfContainer.html do something like this:
<html>
<head>
<style>
body {
margin:0px;
}
</style>
</head>
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="MySwf" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="/stuff/mySwf.swf" />
<param name="quality" value="high" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="/stuff/mySwf.swf" quality="high"
width="100%" height="100%" name="MySwf" align="middle"
play="true"
loop="true"
quality="high"
allowscriptaccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</body>
</html>
This is just a simple code example, as you'd probably want to use swfobject to load the SWF, but I'll leave that up to you.