Tuesday, 27 March 2012

How to Make Your swf Resize to Fit The Browser Window Automatically

If you want your swf to be as big as it can be in the browser window, and to resize automatically fit the user resizes the browser window:

Change the width and height values to 100%, and the scale to "default".

e.g.

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="100%" id="oxphos" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="oxphos.swf" />
<param name="loop" value="false" />
<param name="menu" value="false" />
<param name="quality" value="high" /> 
<param name="scale" value="default" />
<param name="bgcolor" value="#ffffff" />
<embed src="oxphos.swf" loop="false" menu="false" quality="high" scale="default" bgcolor="#ffffff" width="100%" height="100%" name="oxphos" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
 </object>

Obviously, if you have the script included, then you will need to change the values there too.

By the same token, you could set the swf to fill up most, but not all of the screen, by setting width and height to 80%, for example.

No comments:

Post a Comment

Please enter your message here...