Using swfobject to allow fullscreen with Flex Builder
If you’re trying to develop a flex app that can go fullscreen (allowFullScreen) you’ll get an error in Flex Builder when you try and run code that launches fullscreen mode.
The issue is that allowing fullscreen is set as a param in the code of that embeds the SWF in it’s HTML page not in MXML or ActionScript. Here’s how to use swfobject instead of Adobe’s default AC_OET.js so that Flex Builder’s generated HTML allows fullscreen during debugging.
Download swfobject to your Flex Builder project’s ‘html-template’ directory (unzipping it so swfobject.js is in that folder). Then change index.template.html to the following:
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${application}</title>
<style>
body { margin: 0px; overflow:hidden }
</style>
</head>
<body scroll="no">
<script type="text/javascript" src="swfobject.js"></script>
<div id="${application}">
This text is replaced by the Flash movie.
</div>
<script type="text/javascript">
var so = new SWFObject("${swf}.swf", "${application}", "${width}", "${height}", "9", "${bgcolor}");
so.addParam("allowFullScreen", "true");
so.write("${application}");
</script>
</body>
</html>
That’s it! Now when you debug from within Flex Builder you can try out your fullscreen code.
This entry was written by
Alastair, posted on
March 1, 2008 at 9:39 pm, filed under
ActionScript,
Flex. Bookmark the
permalink. Follow any comments here with the
RSS feed for this post.
or leave a trackback:
Trackback URL.
© Copyright 2006 - 2012 Alastair Dawson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.