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:
HTML:
-
...
-
<SCRIPT LANGUAGE="JavaScript">
-
<!--
-
function newSize(width,height) {
-
if(document.all && !document.getElementById) {
-
document.all['myflash'].style.pixelWidth = width;
-
document.all['myflash'].style.pixelHeight = height;
-
}else{
-
document.getElementById('myflash').style.width = width;
-
document.getElementById('myflash').style.height = height;
-
}
-
}
-
//-->
-
</script>
-
</head>
-
<div id="myflash" style="position:relative; width:100%; height:100%; z-index:1; min-width:1000px;">
-
...
-
</object>
-
</div>
and in the movie do:
Other info here
November 14th, 2006 at 2:13 pm
[...] I've found that resizing a flash movie to fit his content has a little drawback: the mouse wheel doesn't work when the movie has focus, and in my case the movie has width: 100%. Luckily I've found a nice javascript to scroll the page. [...]
December 28th, 2006 at 2:10 pm
This was pretty helpful stuff, thanks!
November 1st, 2007 at 10:58 pm
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?
November 10th, 2007 at 8:01 pm
I don't know, it seems to work to me, but if you find some problem let me know