This is sort of a last minute emergency, (deadline for IGF Student Competition in a day’s time!), but I’ve been having problems getting Flashpunk in full screen in browsers. It works fine in the Projector / stand-alone .exe, but in the browser, it just causes the game to hang.
I have now spent close to 2 hours trying different things I’ve found online. If anyone has done this successfully in Flashpunk before, please help!
Here is the code I’m using to do it in the Projector:
public function togglefullscreen():String
{
if (FP.stage.displayState == "normal")
{
FP.stage.displayState = "fullScreenInteractive";
FP.stage.scaleMode = StageScaleMode.SHOW_ALL;
FP.stage.align = "";
return 'fullscreen small';
}
else //if Fullscreen
{
if (FP.stage.scaleMode == StageScaleMode.SHOW_ALL)
{
FP.stage.scaleMode = StageScaleMode.NO_SCALE;
return 'windowed';
}
else
{
FP.stage.displayState = "normal";
return 'fullscreen';
}
}
}
The main problem afaik is the security in browsers; apparently in order to toggle full-screen, it needs to come from user input. (It does already come via user input, but I guess it’s because I’m using Flashpunk’s Input.check that Flash doesn’t recognize it as user input)
Considering the above, I tried following a second tutorial with this HERE. This time, in the browser nothing happens, but in the projector I get a ‘Full screen not allowed’ error!
(Yes i DO have full screen allowed under settings, and yes in my html file I have the parameter’s correctly, unless this code is wrong:
<title>Rhythm Doctor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<param name="allowFullScreen" value="true" />
<param name="allowFullscreen" value="true" />
<param name="allowFullScreenInteractive" value="true" />
<script src="js/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">
var flashvars = {
};
var params = {
menu: "true",
scale: "noScale",
allowFullscreen: "true",
allowFullScreen: "true",
allowFullScreenInteractive: "true",
allowScriptAccess: "always",
bgcolor: "#804040"
};
var attributes = {
id:"RhythmDoctor"
};
swfobject.embedSWF("RhythmDoctor.swf", "altContent", "100%", "100%", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>
<style type="text/css">
html, body { height:100%; overflow:hidden; }
body { margin:0; }
</style>
</head> ```
(as you can, well should, see, I found both 'allowsFullScreen' and 'allowsfullScreen' on Adobe's website, so i just included both parameters as a precaution.)
So, my conclusion is I think this is due to FP.stage and stage, and how they work or something?
Thanks for reading!