Hiding and Restoring Flash Objects

Page: 1

Author Post
Member
Registered: Apr 2009
Posts: 47
Hi Byron

I've got a page where a Flash panorama is hidden (as it should be) when FB shows some images, but it doesn't reshow the Flash object when FB closes. I'm using SWFObject to show the Flash object. I think I should be able to use FB to show the Flash object instead, which I think should cure the problem, but I'm not sure of the syntax. I've tried a few variations, but not got it working. You can see the page in question here:

http://reeddesign.co.uk/panoramas/cornwall/ladock.html

Thanks

Roy

Edit: I should probably mention that the Flash object does reshow in IE, but not in other browsers.
« Last edit by RoyReed on Wed Jan 23, 2013 11:24 pm. »
Administrator
Registered: Aug 2008
Posts: 3382
Your current Flash object is created with the following SWFObject code:
<script src="../../scripts/swfobject2.js" type="text/javascript"></script>
<script type="text/javascript">
var flashvars = {};
var params = {};
params.play = "true";
params.loop = "false";
params.quality = "autohigh";
params.scale = "showall";
params.bgcolor = "#ffffff";
params.wmode = "transparent";
params.allowfullscreen = "true";
var attributes = {};
swfobject.embedSWF("flash/Ladock.swf", "myFlashMovie", "560", "360", "9.0.0", "../flash/expressInstall.swf", flashvars, params, attributes);
</script>

The equivalent fb.flashObject code is:
<script type="text/javascript">
fb.flashObject ( {
source: "flash/Ladock.swf",
width: 560,
height: 360,
params: {
loop: "false",
quality: "autohigh",
scale: "showall",
bgcolor: "#ffffff",
wmode: "transparent"
},
id: "myFlashMovie",
minVersion: "9.0.0"
} );
</script>
This assumes that floatbox.js is already loaded on the page (i.e., its include line is place above this script block).

You can get away with not hiding the Flash object because it does not use the default wmode of "window". It is only wmode="window" Flash objects that have the problem of displaying over top of all other content regardless of z-index values. Your simplest remedy is to set the Floatbox option hideObjects to false.

Floatbox should obviously be successful in unhiding any objects that it has hidden so I'll get that fixed up for subsequent releases. I seem to recall that SWFObject does some peculiar manipulations of an object's display state in its own code.
Member
Registered: Apr 2009
Posts: 47
Thanks for that. I'll go with hideObjects: false for now. And it's good to know the right syntax for FB's Flash loader - no point in having two scripts on the page doing the same job.
« Last edit by RoyReed on Thu Jan 24, 2013 9:26 am. »
Member
Registered: Apr 2009
Posts: 47
I've added hideObjects: false to the original page and that works perfectly, but I thought I'd just do a test using your fb.flashObject code snippet. I had to place it in the the <body> to ensure that floatbox.js loaded before it ran and also inside <div class="flashcontainer"> to place the Flash object there, but what it doesn't do that SWFObject did is hide the 'no Flash' warning message when the Flash object loads.

http://reeddesign.co.uk/panoramas/cornwall/test.html
« Last edit by RoyReed on Thu Jan 24, 2013 11:23 am. »
Administrator
Registered: Aug 2008
Posts: 3382
I don't understand. You have a link on your page with a clickable text of "You need Flash to view the contents of this page". This is in the page's HTML and is not placed there by Floatbox.

I suspect what you want is to place that link as the altContent parameter to the fb.flashObject call. Then, if the Flash object cannot be shown, the altContent will be shown.

The fb.flashObject function already has a built-in default altContent that's very similar to the link on your page. You'll do fine if you just delete that link. See the API Reference for the full syntax of fb.flashObject.
Member
Registered: Apr 2009
Posts: 47
admin wrote
I don't understand. You have a link on your page with a clickable text of "You need Flash to view the contents of this page". This is in the page's HTML and is not placed there by Floatbox.

Yes, and it's there on the version of the page where Flash is loaded by SWFObject, but there, when Flash loads the link is hidden.

I didn't realise that FB uses a different method to do the same job.
Administrator
Registered: Aug 2008
Posts: 3382
Ah, I see. I didn't realize SWFObject uses a different method to the same end. I'm not an expert on it as I never have the need to use it. ;)
Member
Registered: Apr 2009
Posts: 47
Thanks, Byron - it's working perfectly now. :D

Page: 1