Thanks to Geoff Stearns' SWFObject we can detect, install and embed the flash movies with ease. SWFObject is written in JavaScript and, without getting into the legalities, it automatically eliminates the EOLAS security patch; when you are required to 'Activate' a flash movie before you can begin interacting with it.
If you are not using this tool, please do yourself a favour and download it. I always use this tool to embed flash movies and you will defiantly see it on this site and all my flash posts. Here is a snapshot. In action. In its simplest form.
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
-
<!-- SWFObject embed by Geoff Stearns http://blog.deconcept.com/swfobject/ -->
-
<script type="text/javascript" src="swfobject.js"></script>
-
</head>
-
-
<div id="flashcontent">
-
Place alternate content here
-
</div>
-
-
<script type="text/javascript">
-
// <![CDATA[
-
var so = new SWFObject("movie.swf", "", "300", "300", "6");
-
so.write("flashcontent");
-
// ]]>
-
</script>
-
-
</body>
-
</html>
Once you've downloaded SWFObject 1.5 and copied swfobject.js to working folder, begin by declaring the JavaScript file inside your tag.
-
<!-- SWFObject embed by Geoff Stearns http://blog.deconcept.com/swfobject/ -->
-
<script type="text/javascript" src="swfobject.js"></script>
Inside the <body> tag, create a placeholder <div> for your movie. If your users do not have the flash plugin or the version you specify, they will see Place alternate content here.
-
<div id="flashcontent">
-
Place alternate content here
-
</div>
Your last step is to use JavaScript to load your movie; the script should always go to the bottom of the <body> tag.
-
<script type="text/javascript">
-
// <![CDATA[
-
-
var so = new SWFObject("movie.swf", "", "300", "300", "6");
-
so.write("flashcontent");
-
-
// ]]>
-
</script>
- The new SWFObject constructor is defined with SWFObject (path, name, width, height, version);
- The method write() requires one parameter, which is the ID of your placeholder <div>.
Make sure to check out the supporting document(s) from the download to see all your options when using SWFObject. For example, within the constructor you can change the movies background color and enable ExpressInstall. You also have access to all your <embed>/<object> settings using the method addParam(name, value) and you can set your FlashVars using addVariable (name, value).
- Removing the flash menu.
so.addParam("menu", "false"); - Making your movie's background transparent.
so.addParam("wmode", "transparent");
- Passing a variable or two.
so.addVariable("thisSite", "http://xhtml.marlonvalenzuela.net");
so.addVariable("hubSite", "http://marlonvalenzuela.net");



