Resize Flash at runtime

If your content is bigger than the average screen size, using a flash scrollbar for the entire document is really slow and not user-friendly, so its better to enlarge flash to fit the content and scroll the entire page with the browser’s scroll bar.

Put the flash object in a div:

...
<SCRIPT LANGUAGE="JavaScript">
<!--
function newSize(width,height) {
	if(document.all && !document.getElementById) {
 		document.all&#91;'myflash'&#93;.style.pixelWidth = width;
 		document.all&#91;'myflash'&#93;.style.pixelHeight = height;
	}else{
		document.getElementById('myflash').style.width = width;
		document.getElementById('myflash').style.height = height;
	}
}
//--> 
</script>
</head>
<body>
<div id="myflash" style="position:relative; width:100%; height:100%; z-index:1; min-width:1000px;">
<object>
 ...
</object>
</div>

and in the movie do:
[as] getURL(“javascript:newSize(‘1000px’, ‘100%’)”);
[/as]

Other info here

4 thoughts on “Resize Flash at runtime

  1. Pingback: Madarco DevBlog » Blog Archive » Scroll browser window inside Flash

  2. LadySamG says:

    Hi,
    I tried your code and it works fine in a mozilla firefox browser, but not with IE7. Is there some part of this code that IE7 doesn’t like?

Comments are closed.