I’m trying to do something a little different with my flash embedding on an HTML page. I added an option to the right click context menu to toggle between two scales modes: noscale and exactfit. This works when I run the swf as a standalone but not within an HTML page. Does anyone have any ideas if there a way to embed a swf and dynamically change the scale mode? Perhaps embedding with 100% width and height? However I tried that and it breaks the embed javascript code.
<script type="text/javascript">
var params = {};
params.scale = "exactfit"
var flashVars = {};
swfobject.embedSWF("UserInterfaceStagingCR.swf", "myContent", "1440", "900", "9", null, flashVars, params);
</script>
See this post about resizing a SWF set to 100% width/height.
But if you want to switch from
noScaletoexactFit(and vice-versa), you probably need to edit theparamnode in your JavaScript.I’ve never actually tried it (I’m not sure if it will work), but here’s what I’d experiment with:
(Of course, this code would need to be modified if you have multiple SWFs on a page.)
Then have your ActionScript invoke the JavaScript via ExternalInterface: