Flash: Full window flash, and when minimum size scrollbars with SwfObject 2.0’s Dynamic Publishing July 31, 2008
In the post "Elastic flash with scrollbars" a nice javascript library is presented to scale full window flash when the browser hits a certain. point. Worked great with SWFObject 1.0, but didn't work with SWFObject 2.0 and dynamic publishing without a tweak.
Here's the Javascript I'm using:
-
-
var params = {};
-
params.allowscriptaccess = "always";
-
params.menu = false;
-
var attributes = {};
-
attributes.id = "flashUI"; // what to call with External Interface
-
attributes.name = "flashUI";
-
swfobject.embedSWF("index.swf", "contentToReplaceDiv", "100%", "100%", "9.0.0", "expressInstall.swf", fv, params, attributes);
-
-
var scale = new FlashScaler("flashUI", 1280,768);
-
scale.resize();
This got the scaling to work but not on the original load, if the window was smaller than the minimum dimensions, as the load event has already been called. So I had to modify FlashScaler to call the resize function during constructor e.g.
-
-
function FlashScaler(flashdiv,w,h){
-
-
var flashObj = document.getElementById(flashdiv);
-
var minW = w;
-
var minH = h;
-
addWindowEvent("onload",resize);
-
addWindowEvent("onresize",resize);
-
resize(); //<-- added this line
-
.........
SWFForceSize is similar. "Size limiting for full window flash" Not exactly sure how they differ internally, but the approach that might work is hinted in the documentation and API But only when static publishing via the use of
-
-
swfobject.getObjectById(objectIdStr)
and perhaps passing it into SWForceSize? Don't know.
UPDATE: FlashScaler with this approach doesn't work with IE6, or IE7, gives script errors, looking into it.

Add a Comment: