SWFObject add-on: Size limiting for full window flash

[slug]swfforcesize[/slug]Here’s another add-on for SWFObject. This one allows you to create a full-window flash movie, but when the browser window is set below the specified size, the div containing the flash is kept at the minimum size and horizontal/vertical scrollbars are displayed.

Again it’s easy to implement, you have to make a few small changes to the HTML/CSS/JavaScript

Firstly, you have to remove the !DOCTYPE declaration from the very top of the HTML document, as, for some reason, this causes the browser to scroll, even though the flash container is set to 100% height. Then modify the CSS so the the html’s overflow is set to auto. Also, the #flashcontent div needs to have it’s positioning set to absolute, this stops Safari on Mac OS from showing the vertical scrollbar.
html {
height: 100%;
overflow: auto;

#flashcontent {
position: absolute;
top: 0px;
left: 0px;
height: 100%;
width: 100%;

In the javascript, do the following:
var so = new SWFObject(‘flash.swf’, ‘website’, ’100%’, ’100%’, ’8′, ‘#333333′);


so.addParam(‘menu’, ‘false’);
so.addParam(‘scale’, ‘noscale’);
so.addParam(‘salign’, ‘lt’);

if( so.write(‘flashcontent’) )
var forcesize = new SWFForceSize( so, 900, 600 );

When you call the ‘SWFForceSize’ constructor, the last two arguments are the minimum width and height of the movie, in this case the minimum size is 900×600 px.

Download SWFForceSize here.