Using document.write to pass url parameters to Flash
Page source:
<html>
<head>
<meta http-equiv=content-type content="text/html; charset=iso-8859-1">
<title>flash page</title>
<style>
body {
margin: 0;
background: white;
}
</style>
<script language="javascript">
<!--
function init() {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
document.write('width="100%" height="100%" id="header" align="" >');
document.write('<param name="movie" value="static/swf/header.swf?l1=' + top.l1 + '&l2=' + top.l2 + '&l3=' + top.l3 + '">');
document.write('<param name="loop" value="false">');
document.write('<param name="menu" value="false">');
document.write('<param name="quality" value="best">');
document.write('<param name="salign" value="lt">');
document.write('<param name="bgcolor" value="#ffffff">');
document.write('<embed src="static/swf/header.swf?l1=' + top.l1 + '&l2=' + top.l2 + '&l3=' + top.l3 + '" ');
document.write(' loop="false"');
document.write(' menu="false"');
document.write(' quality="best"');
document.write(' salign="lt"');
document.write(' bgcolor="#ffffff"');
document.write(' height="100%"');
document.write(' width="100%"');
document.write(' name="header"');
document.write(' align=""');
document.write(' type="application/x-shockwave-flash"');
document.write(' pluginspage="http://www.macromedia.com/go/getflashplayer">');
document.write('</embed>');
document.write('</object>');
}
-->
</script>
</head>
<body>
<script language="javascript">
<!--
init();
-->
</script>
</body>
</html>
Embedding while still W3C-compliant
Update: Bugger. Can't set bgcolor with this method.
Embedding flash without <embed>- Example page: http://damowmow.com/playground/demos/flash/001.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html lang="en">
<head>
<title>Flash with OBJECT elements</title>
</head>
<body>
<p>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
width="300" height="120">
<param name="movie" value="http://www.macromedia.com/shockwave/download/triggerpages_mmcom/flash.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<!--[if !IE]> <-->
<object data="http://www.macromedia.com/shockwave/download/triggerpages_mmcom/flash.swf"
width="300" height="120" type="application/x-shockwave-flash">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">
FAIL (the browser should render some flash content, not this).
</object>
<!--> <![endif]-->
</object>
</p>
</body>
</html>
If omitting EMBED, then please be sure to test your work across the range of your audience's browsers... Drew and Daniel didn't describe which browsers they tested on, but from all I've seen they apparently test just on visibility of content... if you're doing things such as parameter-passing, FlashVars? data, WMODE setting, DOM location for FSCommand or other features which directly involve the browser, then testing these individual features across browsers, in addition to just visibility, is vital to make sure that your audiences have the same experience you see on your authoring machine.
XHTML compliant embedding using Javascript
Web standards compliant Javascript Flash detect and embedAuthors:
-- ArthurClemens - 15 Jan 2005

