I’ve tried a thousand ways and it is getting frustrating…
Attempt one
AS3
function setFullScreen():void {
if (stage.displayState== “normal”) {
stage.displayState=“fullScreen”;
stage.scaleMode = StageScaleMode.NO_SCALE;
} else {
stage.displayState=“normal”;
}
}
button1.addEventListener(MouseEvent.CLICK, goFull);
function goFull(event:MouseEvent):void {
setFullScreen();
}
HTML
<!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”>
<head>
<title>Stat_Project</title>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<style type=“text/css” media=“screen”>
html, body { height:100%; background-color: #ffffff;}
body { margin:0; padding:0; overflow:hidden; }
#flashContent { width:100%; height:100%; }
</style>
</head>
<body>
<div id=“flashContent”>
<object classid=“clsid:d27cdb6e-ae6d-11cf-96b8-444553540000” width=“1000” height=“700” id=“Stat_Project” align=“middle”>
<param name=“movie” value=“Stat_Project.swf” />
<param name=“quality” value=“high” />
<param name=“bgcolor” value="#ffffff" />
<param name=“play” value=“true” />
<param name=“loop” value=“true” />
<param name=“wmode” value=“window” />
<param name=“scale” value=“showall” />
<param name=“menu” value=“true” />
<param name= “allowFullScreen” value= “true” />
<param name=“devicefont” value=“false” />
<param name=“salign” value="" />
<param name=“allowScriptAccess” value=“sameDomain” />
<!–[if !IE]>–>
<object type=“application/x-shockwave-flash” data=“Stat_Project.swf” width=“1000” height=“700”>
<param name=“movie” value=“Stat_Project.swf” />
<param name=“quality” value=“high” />
<param name=“bgcolor” value="#ffffff" />
<param name=“play” value=“true” />
<param name=“loop” value=“true” />
<param name=“wmode” value=“window” />
<param name=“scale” value=“showall” />
<param name=“menu” value=“true” />
<param name= “allowFullScreen” value= “true” />
<param name=“devicefont” value=“false” />
<param name=“salign” value="" />
<param name=“allowScriptAccess” value=“sameDomain” />
<!–<![endif]–>
<a href=“http://www.adobe.com/go/getflash”>
<img src=“http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif” alt=“Get Adobe Flash player” />
</a>
<!–[if !IE]>–>
</object>
<!–<![endif]–>
</object>
</div>
</body>
</html>
Attempt two:
AS3 class
package{
//import all classes
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageDisplayState;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.FullScreenEvent;
import flash.events.MouseEvent;
import flash.net.URLRequest;
public class MainClass extends Sprite
{
//create variables
public function MainClass() {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, stageResize);
stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullscreen);
fullscreen_btn.addEventListener(MouseEvent.CLICK, goFullscreen);
fullscreen_btn.buttonMode = true;
}
private function onFullscreen(e:FullScreenEvent):void
{
fullscreen_btn.gotoAndStop(e.fullScreen?2:1);
}
private function goFullscreen(e:MouseEvent):void
{
if( stage.displayState == StageDisplayState.NORMAL ){
stage.displayState = StageDisplayState.FULL_SCREEN;
} else {
stage.displayState = StageDisplayState.NORMAL;
}
}
private function stageResize(e:Event=null):void
{
fullscreen_btn.x = Math.floor(stage.stageWidth - fullscreen_btn.width - 10);
fullscreen_btn.y = 10;
}
}
}
What am I doing wrong??? This is so frustrating…