<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blogizm &#187; Mootools</title>
	<atom:link href="http://blog.aquamedia.com.au/category/development/mootools/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.aquamedia.com.au</link>
	<description>Thoughts and views expressed online by the staff at Aqua Media</description>
	<lastBuildDate>Tue, 08 Jun 2010 07:03:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using swfObject with Mootools</title>
		<link>http://blog.aquamedia.com.au/2009/08/using-swfobject-with-mootools/</link>
		<comments>http://blog.aquamedia.com.au/2009/08/using-swfobject-with-mootools/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 23:47:03 +0000</pubDate>
		<dc:creator>Flashnutz</dc:creator>
				<category><![CDATA[Flash & ActionScript]]></category>
		<category><![CDATA[Mootools]]></category>
		<category><![CDATA[embed flash with mootools]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[swfObject]]></category>

		<guid isPermaLink="false">http://blog.aquamedia.com.au/2009/08/using-swfobject-with-mootools/</guid>
		<description><![CDATA[
			
				
			
		
I'm sure most of us use swfObject, which in my opinion is the best option when it comes to embedding flash.
Lately I've been having a lot of fun with mootools  and needed a way to embed flash dynamically. Basically I wanted my flash file to be embedded after a mootools click event was triggered.
So [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 15px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.aquamedia.com.au%2F2009%2F08%2Fusing-swfobject-with-mootools%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.aquamedia.com.au%2F2009%2F08%2Fusing-swfobject-with-mootools%2F&amp;source=aquamedia&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I'm sure most of us use swfObject, which in my opinion is the best option when it comes to embedding flash.</p>
<p>Lately I've been having a lot of fun with mootools  and needed a way to embed flash dynamically. Basically I wanted my flash file to be embedded after a mootools click event was triggered.</p>
<p>So without further ado..</p>
<pre class="javascript">window.<span style="color: #006600;">addEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'domready'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">//get the div I want to embed my flash into.</span>
<span style="color: #003366; font-weight: bold;">var</span> flashcontainer = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'flashcontainer'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #009900; font-style: italic;">//set all the flash properties</span>
<span style="color: #003366; font-weight: bold;">var</span> file = <span style="color: #3366CC;">'file.swf'</span>;
<span style="color: #003366; font-weight: bold;">var</span> moviename = <span style="color: #3366CC;">'nameMyFlash'</span>;
<span style="color: #003366; font-weight: bold;">var</span> width = <span style="color: #3366CC;">'640'</span>;
<span style="color: #003366; font-weight: bold;">var</span> height = <span style="color: #3366CC;">'424'</span>;
<span style="color: #003366; font-weight: bold;">var</span> version = <span style="color: #3366CC;">'9'</span>;
<span style="color: #003366; font-weight: bold;">var</span> bgcolor = <span style="color: #3366CC;">'#000000'</span>;
&nbsp;
<span style="color: #009900; font-style: italic;">//create the function that will fuse swfObject with mootools</span>
<span style="color: #003366; font-weight: bold;">var</span> embedFlash = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> so = <span style="color: #003366; font-weight: bold;">new</span> SWFObject<span style="color: #66cc66;">&#40;</span>file, moviename, width, height, version, bgcolor<span style="color: #66cc66;">&#41;</span>;
	     so.<span style="color: #006600;">addParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;quality&quot;</span>, <span style="color: #3366CC;">&quot;high&quot;</span><span style="color: #66cc66;">&#41;</span>;
	     so.<span style="color: #006600;">addParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;align&quot;</span>, <span style="color: #3366CC;">&quot;middle&quot;</span><span style="color: #66cc66;">&#41;</span>;
	     so.<span style="color: #006600;">addParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;play&quot;</span>, <span style="color: #3366CC;">&quot;true&quot;</span><span style="color: #66cc66;">&#41;</span>;
	     so.<span style="color: #006600;">addParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;loop&quot;</span>, <span style="color: #3366CC;">&quot;true&quot;</span><span style="color: #66cc66;">&#41;</span>;
	     so.<span style="color: #006600;">addParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;scale&quot;</span>, <span style="color: #3366CC;">&quot;exactfit&quot;</span><span style="color: #66cc66;">&#41;</span>;
             so.<span style="color: #006600;">addParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;allowFullScreen&quot;</span>, <span style="color: #3366CC;">&quot;true&quot;</span><span style="color: #66cc66;">&#41;</span>;
	     so.<span style="color: #006600;">addVariable</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;variable1&quot;</span>, <span style="color: #3366CC;">&quot;variable 1 value goes here&quot;</span><span style="color: #66cc66;">&#41;</span>;
	     so.<span style="color: #006600;">addVariable</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;variable2&quot;</span>, <span style="color: #3366CC;">&quot;variable 1 value goes here&quot;</span><span style="color: #66cc66;">&#41;</span>;
	     so.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span>flashcontainer<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">//get button by id</span>
<span style="color: #003366; font-weight: bold;">var</span> myButton = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'mybutton'</span><span style="color: #66cc66;">&#41;</span>; 
&nbsp;
<span style="color: #009900; font-style: italic;">// create click event to fire my function called &quot;embedFlash()&quot;</span>
myButton.<span style="color: #006600;">addEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'click'</span>, embedFlash<span style="color: #66cc66;">&#41;</span>; 
&nbsp;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>And that's it.. Hope it helps....</p>
<blockquote><p>You can download the latest tools used above from the links below:<br />
<a title="MooTools - download release 1.2.3" href="http://mootools.net/download" target="_blank">MooTools - download release 1.2.3</a> or <a title="SWFObject is an easy-to-use and standards-friendly method to embed Flash content, which utilizes one small JavaScript file" href="http://code.google.com/p/swfobject/downloads/list" target="_blank">SWFObject 2.2</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.aquamedia.com.au/2009/08/using-swfobject-with-mootools/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
