/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function setFlashSize(flashWidth,flashHeight){ var size = [0,0]; if( typeof( window.innerWidth ) == 'number' ) { size = [window.innerWidth, window.innerHeight]; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { size = [document.documentElement.clientWidth, document.documentElement.clientHeight]; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { size = [document.body.clientWidth, document.body.clientHeight]; } window.onresize = function() { document.getElementById("flashContainer").style.minWidth = flashWidth+"px"; document.getElementById("flashContainer").style.minHeight = flashHeight+"px"; document.getElementById("flashContainer").style.width = size[0] < flashWidth ? flashWidth+"px" : "100%"; document.getElementById("flashContainer").style.height = size[1] < flashHeight ? flashHeight+"px" : "100%"; }; window.onload = function(){ window.onresize(); } } SWFObject.embedSWF("example.swf", "flashMovie", "100%", "100%", "6.0.0","expressInstall.swf"); setFlashSize(600,400);
URL: http://www.thetechlabs.com/tutorials/flash/swfobject-and-best-practice-implementation/