Difference between revisions of "SWFObject"

From Wikicliki
Jump to: navigation, search
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''STATIC PUBLISHING'''
 
 
 
SWFObject is a better way to embed swf files in html. Its shorter than Adobe's AC_RunActiveContent, makes the flash file more compatible for other devices which use less advanced versions of javascript, and it degrades gracefully on ancient browsers.
 
SWFObject is a better way to embed swf files in html. Its shorter than Adobe's AC_RunActiveContent, makes the flash file more compatible for other devices which use less advanced versions of javascript, and it degrades gracefully on ancient browsers.
  
Are you easily confused? Is your wmode not transparent even after checking it a hundred times over?
+
*[http://code.google.com/p/swfobject/wiki/documentation SWFObject Documentation]
Stop messing up the code and use the [http://www.swffix.org/swfobject/generator/ SWFobject code generator.]
 
  
1. insert the object
+
== SWF code generator ==
  
<pre>      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="420">
+
Are you easily confused? Are your flashvars going missing? <br>
        <param name="movie" value="myContent.swf" />
+
Is your wmode not transparent even after checking it a hundred times over?<br>
        <!--[if !IE]>-->
+
Stop beating yourself in the face and use the [http://www.swffix.org/swfobject/generator/ SWFobject code generator]<br>
        <object type="application/x-shockwave-flash" data="myContent.swf" width="780" height="420">
+
It works, bitches. Especially when you need to rewrite it after making a complete muddle of trying to customise it.
        <!--<![endif]-->
 
          <p>Alternative content</p>
 
        <!--[if !IE]>-->
 
        </object>
 
        <!--<![endif]-->
 
      </object>
 
</pre>
 
  
2. insert into head (the file)
+
*[http://www.alistapart.com/articles/flashembedcagematch/ Why it makes sense to use SWFObject]
<pre><script type="text/javascript" src="swfobject.js"></script></pre>
 
  
 +
== Working Example ==
  
3. insert into head (the registration)
+
<pre>
 
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<pre>   <script type="text/javascript">
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    swfobject.registerObject("myId", "9.0.0", "expressInstall.swf");
+
<head>
    </script></pre>
+
<title></title>
 +
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 +
<script type="text/javascript" src="swfobject.js"></script>
 +
<script type="text/javascript">
 +
swfobject.registerObject("quoteRotatored", "9.0.0");
 +
</script>
 +
<title>embed flash</title>
 +
<style>
 +
body {background:url(background.jpg); margin-left:0px; margin-top:0px}
 +
.container { }
 +
</style>
 +
</head>
 +
<body>
 +
<div>
 +
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="200" height="250" id="quoteRotatored">
 +
<param name="movie" value="quoteRotatored.swf" />
 +
<param name="wmode" value="transparent" />
 +
<!--[if !IE]>-->
 +
<object type="application/x-shockwave-flash" data="quoteRotatored.swf" width="200" height="250">
 +
<param name="wmode" value="transparent" />
 +
<!--<![endif]-->
 +
 +
<!--[if !IE]>-->
 +
</object>
 +
<!--<![endif]-->
 +
</object>
 +
</div>
 +
</body>
 +
</html>
 +
</pre>
  
*[http://www.alistapart.com/articles/flashembedcagematch/ Why it makes sense to use SWFObject]
 
*[http://code.google.com/p/swfobject/wiki/documentation SWFObject Documentation]
 
  
 
== See Also ==
 
== See Also ==
Line 39: Line 56:
 
*[[Actionscript]]
 
*[[Actionscript]]
 
*[[Actionscript Sandbox]]
 
*[[Actionscript Sandbox]]
 +
[[Category:Programming]]

Latest revision as of 03:41, 1 June 2009

SWFObject is a better way to embed swf files in html. Its shorter than Adobe's AC_RunActiveContent, makes the flash file more compatible for other devices which use less advanced versions of javascript, and it degrades gracefully on ancient browsers.

SWF code generator

Are you easily confused? Are your flashvars going missing?
Is your wmode not transparent even after checking it a hundred times over?
Stop beating yourself in the face and use the SWFobject code generator
It works, bitches. Especially when you need to rewrite it after making a complete muddle of trying to customise it.

Working Example

<!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></title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<script type="text/javascript" src="swfobject.js"></script>
		<script type="text/javascript">
			swfobject.registerObject("quoteRotatored", "9.0.0");
		</script>
<title>embed flash</title>
<style>
body {background:url(background.jpg); margin-left:0px; margin-top:0px}
.container { }
</style>
	</head>
	<body>
		<div>
			<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="200" height="250" id="quoteRotatored">
				<param name="movie" value="quoteRotatored.swf" />
				<param name="wmode" value="transparent" />
				<!--[if !IE]>-->
				<object type="application/x-shockwave-flash" data="quoteRotatored.swf" width="200" height="250">
					<param name="wmode" value="transparent" />
				<!--<![endif]-->
					
				<!--[if !IE]>-->
				</object>
				<!--<![endif]-->
			</object>
		</div>
	</body>
</html>


See Also