Reputation: 9148
This is a simple page I am trying to add a .swf to, with a small custom made js function I slapped up. With chrome the swf is pushed up and out of the navigator window and is missing the top half.
I have tried this quick and dirty approach to detect browser and set the proper background values for each browser:
var browser = BrowserDetect.browser;
var height = '';
var width = '';
switch (browser){
case "Explorer":
height = '800';
width = '1000';
break;
case "Chrome":
height = '100%';
width = '100%';
break;
case "Firefox":
height = '800';
width = '1000';
break;
default:
height = '800';
width = '1000';
}
The values from the above set the values for the following, in wich is where I can smell the problem is located:
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="1000" height="800" id="flash28" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="/sites/all/themes/morin/bin/flash28.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /> <embed src="/sites/all/themes/morin/bin/flash28.swf" quality="high" bgcolor="#000000" width="1000" height="800"
name="flash28" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>
</noscript>
For the movie size in the embed tag: I have tried percents, I have tried pixels, quite a few different combinations. There is always at least one browser that chokes no matter how I set it. Right now it is chrome that chokes. Does anyone knowing the trick to these parameters mind clueing me in on a proper efficient method to integrate a .swf?
Maybe the outer html code is not properly structured and causes this? I am not specialised integration, I am mostly a back-ender, tried a few solutions online but this custom .js that sets values for <nosript>
is the only way I managed to get this close to working crossbrowser.
My question basically, what are the clean efficient ways used by integrators to integrate swf cross browser, and is my approach workable if I set proper values?
Any help/insight appreciated, thanks SO.
Upvotes: 2
Views: 86
Reputation: 3565
Basically, I would advise you to use SWFObject
It is an open source javascript library file that will handle exactly what you are trying to do.
It also is a "standard" in the flash community.
In the downloads list on the google code page, there is a handy generator as well to help you with your embedding code.
Cheers
Upvotes: 1