Return to Snippet

Revision: 15279
at June 29, 2009 23:36 by arpit


Initial Code
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);

Initial URL
http://www.thetechlabs.com/tutorials/flash/swfobject-and-best-practice-implementation/

Initial Description

                                

Initial Title
Javascript window sizing for swf

Initial Tags
flash

Initial Language
JavaScript