Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Make SWF fullscreen or stretch to fill window

SWF fullscreen



2:26 am on Nov 10, 2011 (gmt 0)

I have searched and tried many things but I can't figure out how to make my SWF's full screen or even stretch to fill the window.

I am putting together a Flash arcade site for my daughter. There are thousands of SWF game files so variables are used to load them on the page. Many of the files do not contain a fullscreen button so I'm trying to figure out how I can give the option of stretching the SWF to full screen.

Is there such a thing as a SWF wrapper that can give fullscreen capabilities to any SWF without having to edit the action script of all of those game files?

I've even tried adding a "Full Screen" button to the page that opens the SWF in a new window but none of the examples I've come across scale or stretch the SWF to full screen.

The code below only stretches the SWF in width, not height:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("MySwf.swf", "swf_container", "100%", "100%", "10.0.0");

<div id="swf_container">

Anyone able to help me? I'm totally stumped.

The SWF must be embeded on a page because the page contains code that submits the score when it's done playing. So using a link to the SWF instead of a page will not work.

The best solution would be for me to use a wrapper if such a thing exists. However, another issue is that the site uses Smarty so I a wrapper will need to andle Smarty variables for the file name.


4:43 pm on Nov 10, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

You first have to allow full screen via a parameter from the page, like

your_video_object.addParam("allowFullScreen", "true");

The from within your SWF, code the full screen button to set the stage to full screen.

function fullScreen()
Stage.displayState = "fullScreen";


5:01 pm on Nov 10, 2011 (gmt 0)


When you say "from within your SWF" are you saying edit the SWF itself?

If so, that would mean editing thousands of files.

Featured Threads

Hot Threads This Week

Hot Threads This Month