Adobe Flash CS5.5 and AS3 – How to center flash games in the center of the browser

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="content-type" 
content="text/html;charset=ISO-8859-1?>
  <title>Test
  <style type="text/css">

html {
  height:100%; /* fix height to 100% for IE */
  max-height: 100%; /* fix height for other browsers */
  padding: 0; /*remove padding */
  margin: 0; /* remove margins */
  border: 0; /* remove borders */
  background: #ff0000 /*color background – only works in IE */
  overflow: hidden; /*get rid of scroll bars in IE */
  overflow-y: hidden;
  overflow-x: hidden;
}

body {
  height: 100%; /* fix height to 100% for IE */
  max-height: 100%; /* fix height for other browsers */
  padding: 0; /*remove padding */
  margin: 0; /* remove margins */
  border: 0; /* remove borders */
  hide overflow: hidden from IE5/Mac
  overflow: hidden; /*get rid of scroll bars in IE */
  overflow-y: hidden;
  overflow-x: hidden;
}

 </style>
</head>
<body bgcolor="#ff0000? leftmargin="0" topmargin="0" marginwidth="0?
     marginheight="0" scroll="no">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000?
   codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
   width="100%" height="100%">
   <param name="movie" value="Test.swf">
   <param name="quality" value="high">
   <param name="menu" value="false">
   <param name="salign" value="mc">
   <param name="scale" value="noscale">
   <embed src="Test.swf" width="100%" height="100%"
  scale="noscale" quality="high" menu="false"
  pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
  type="application/x-shockwave-flash">
    </embed>
  </object>
  </body>
  </html>

/* Incidentally, if you want to position the swf somewhere other than center, change the salign to either “t”, “lt”, “l”, or “b”, etc. */

Please follow and like us: