Fullscreen no-scaling using swfobject

Hi All,
I use this over and over again so thought I’d pop it here in case I (or anyone else) need to get the code quick!

In ActionScript

import flash.display.StageScaleMode
import flash.display.StageAlign

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resizeHandler);

private function resizeHandler(e.Event):void
{
//move elements as the screen resizes
}

In HTML/CSS/JavaScript

<!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>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Page Title</title>
<script type=”text/javascript” src=”js/swfobject.js”></script>
<script type=”text/javascript”>

var flashvars = {};

var params = {
scale: “noscale”,
allowscriptaccess: “always”,
params.allowfullscreen:”true”
};

var attributes = {};

swfobject.embedSWF(“mm.swf”, “content”, “100%”, “100%”, “9.0.0″, “swf/expressInstall.swf”, flashvars, params, attributes);

* {
margin: 0;
padding: 0;
border: 0;
}

html {
/*no scrollbars for 100% x 100% swf*/
overflow: hidden;
height: 100%;
}

body {
background-color: #fff;
height: 100%;
}

#content {
}

#noFlashContent {
}

<div id=”content”>
<div id=”noFlashContent”>
<h1>YOU NEED FLASH!</h1>
<p><a href=”http://www.adobe.com/go/getflashplayer”><img src=”http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif” alt=”Get Adobe Flash player” /></a></p>
</div>
</div>

Folders and Files needed:

js/swfobject.js
swf/expressInstall.swf

That it!
Jonathan

  1. No comments yet.

  1. No trackbacks yet.