<?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>Tech Mug &#187; swf</title>
	<atom:link href="http://www.techmug.com/tag/swf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techmug.com</link>
	<description></description>
	<lastBuildDate>Tue, 31 Jan 2012 12:15:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Detect Javascript and Flash Enabled</title>
		<link>http://www.techmug.com/detect-javascript-and-flash-enabled/</link>
		<comments>http://www.techmug.com/detect-javascript-and-flash-enabled/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 18:56:07 +0000</pubDate>
		<dc:creator>Fraz Ahmed</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[Detect Javascript]]></category>
		<category><![CDATA[Flash Enabled]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[tactic]]></category>

		<guid isPermaLink="false">http://www.techmug.com/?p=73</guid>
		<description><![CDATA[Javascript and Flash are super tools to enhance the usability of your website. You put a lot of efforts to create beautiful form validation and an attractive flash animation. But all the efforts are ruined when the visitor of your website has disabled Javascript or does not have flash plugin installed. Here I&#8217;ll provide you [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Javascript and Flash</strong> are super tools to enhance the usability of your website. You put a lot of efforts to create beautiful form validation and an <strong>attractive flash animation</strong>. But all the efforts are ruined when the visitor of your website has disabled Javascript or does not have flash plugin installed. Here I&#8217;ll provide you a little solution to escape from this problem.</p>
<p><span id="more-73"></span></p>
<h2>First Tactic &#8211; Detect Javascript Enabled</h2>
<p>Our first step is to detect whether visitor has Javascript enabled or not. If Javascript is not enable, we will redirect user to an error/instruction page <em>(I create a seperate page where I give instructions to visitor that how to enable Javascript in his/her browser)</em>.</p>
<p>Put below code just after the <em>&lt;head&gt;</em> tag in your web page:</p>
<pre class="brush: php; title: ; notranslate">
&lt;noscript&gt;
&lt;meta http-equiv=&quot;refresh&quot; content=&quot;0;URL=error-javascript.php&quot; /&gt;
&lt;/noscript&gt;
</pre>
<p>Above code is executed if Javascript is disabled and redirect user to <em>error-javascript.php</em>. We are using <em>&lt;meta&gt;</em> tag for redirection. If Javascript is not disabled, above code will not be executed.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7217075623453662";
google_ad_slot = "2820701010";
google_ad_width = 336;
google_ad_height = 280;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<center><font-size="9px">Advertisement</font></center></p>
<h2><strong>Second Tactic- Detect Flash Plugin Installed</strong></h2>
<p>There is a<strong> Javascript solution to detect Flash Plugin</strong> Installed and replace Flash animation with your custom message. In order to accomplish the said task you need to place below Javascript instead of your normal embedded code:</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
var MM_contentVersion = 9;
var plugin = (navigator.mimeTypes &amp;&amp; navigator.mimeTypes[&quot;application/x-shockwave-flash&quot;]) ? navigator.mimeTypes[&quot;application/x-shockwave-flash&quot;].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins[&quot;Shockwave Flash&quot;].description.split(&quot; &quot;);
	    for (var i = 0; i &lt; words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i];
	    }
	var MM_FlashCanPlay = MM_PluginVersion &gt;= MM_contentVersion;
}
else if (navigator.userAgent &amp;&amp; navigator.userAgent.indexOf(&quot;MSIE&quot;)&gt;=0
   &amp;&amp; (navigator.appVersion.indexOf(&quot;Win&quot;) != -1)) {
	document.write('&lt;SCR' + 'IPT LANGUAGE=VBScript\&gt; \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject(&quot;ShockwaveFlash.ShockwaveFlash.&quot; &amp; MM_contentVersion)))\n');
	document.write('&lt;/SCR' + 'IPT\&gt; \n');
}
if ( MM_FlashCanPlay ) {
	document.write('&lt;object classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0&quot; width=&quot;160&quot; height=&quot;120&quot;&gt;');
    document.write('&lt;param name=&quot;movie&quot; value=&quot;animation.swf&quot;&gt;');
    document.write ('&lt;param name=&quot;quality&quot; value=&quot;high&quot;&gt;');
	document.write ('&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;');
    document.write('&lt;embed src=&quot;animation.swf&quot; width=&quot;160&quot; height=&quot;120&quot; quality=&quot;high&quot; pluginspage=&quot;http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;&lt;/object&gt;');
} else{
	document.write('&lt;a href=&quot;./&quot;&gt;&lt;img src=&quot;replaced-image.png&quot; alt=&quot;Flash Plugin not Installed&quot; border=&quot;0&quot;&gt;&lt;/a&gt;');

}
//--&gt;

&lt;/script&gt;
</pre>
<p>Above code detect for Version 9 or greater version of flash plugin. If flash plugin is detected it displays flash animation <em>(animation.swf)</em> else it displays an image <em>(replaced-image.png)</em> instead of flash animation. In the place of image you can write more text and instructions. Everything is upto on you.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7217075623453662";
google_ad_slot = "4831550702";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<center><font-size="9px">Advertisement</font></center></p>
<p>Don&#8217;t forget to share the post on your favorite website. It may also help someone somewhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techmug.com/detect-javascript-and-flash-enabled/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>jMouse Follower</title>
		<link>http://www.techmug.com/jmouse-follower/</link>
		<comments>http://www.techmug.com/jmouse-follower/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 19:33:14 +0000</pubDate>
		<dc:creator>Fraz Ahmed</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[follow]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[trail]]></category>

		<guid isPermaLink="false">http://www.techmug.com/?p=28</guid>
		<description><![CDATA[What is Mouse Follower?

Mouse Follower or Cursor Trail is typically an image or set of images which follows the cursor in your browser screen.]]></description>
			<content:encoded><![CDATA[<h2>What is Mouse Follower?</h2>
<p>Mouse Follower or Cursor Trail is typically an image or set of images which follows the cursor in your browser screen.</p>
<h2><strong>Demo and Download</strong></h2>
<p>To understand more clearly visit <a title="jMouse Follower Demo" href="http://www.techmug.com/demo/mouse-follower/" target="_blank">demo</a>. Alternatively you may also download the files from <a title="Download jMouse Follower" href="http://www.techmug.com/demo/mouse-follower/mouse-follower.zip" target="_blank">here</a>.</p>
<h2><strong>Problem</strong></h2>
<p>Today I was asked to enhance the existing mouse trail feature of a website. They were using 3 or 4 PNG images to make the mouse trail. But the problem was that images were inline. While our client wanted some more advanced animation with mouse trail/follower. And that animation was not possible without using flash animation in it.</p>
<p>From the above its clear that we were need to have a DIV in the script where all of the Flash embedded code may be inserted. I searched for many scripts but the problem was that they were doing well with IE but for Firefox answer was NO.</p>
<p><span id="more-28"></span></p>
<h2><strong>Things to do</strong></h2>
<p>Eventually I had to play with code. And surely my first choice for Javascript is always jQuery. Basically the concept was so simple, to achieve Mouse Follower effect we need to do following:</p>
<ol>
<li>Create a DIV for Flash Object (You may also use image in this DIV).</li>
<li>Find X and Y co-ordinates of cursor&#8217;s current position.</li>
<li>Change DIV position according to X and Y position of Cursor.</li>
</ol>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7217075623453662";
google_ad_slot = "2820701010";
google_ad_width = 336;
google_ad_height = 280;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<center><font-size="9px">Advertisement</font></center></p>
<h2><strong>How it works?</strong></h2>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;// &lt;![CDATA[
$(document).ready(function(){
   $(&quot;*&quot;).mousemove(function(e){
	  $(&quot;#follower&quot;).css({'position' : 'absolute', 'margin-left' : e.pageX+10, 'margin-top' : e.pageY+10, 'display' : 'block', 'z-index' : '999'});
   });
})
// ]]&gt;&lt;/script&gt;
</pre>
<p><strong>Explanation</strong></p>
<ol>
<li>In the above code first we define use <em>document.ready()</em> it simply call the underneath function on the load of page.</li>
<li><em>$(&#8220;*&#8221;).mousemove(function(e){</em>&#8230; &#8211; this line reads that call the function whenever mouse move on any element of the page. <em>mousemove</em> is a jQuey event. Click <a title="jQuery Events" href="http://docs.jquery.com/Events" target="_blank">here</a> to learn more jQuery events.</li>
<li><em>$(&#8220;#follower&#8221;).css({</em>&#8230; &#8211; this line looks for an element which ID is &#8220;follower&#8221;. This is our Flash Object DIV. In this line we change the CSS style of our DIV. jQuery has made it much easy for us to change the CSS style of any element on the move.</li>
<li>We get X and Y co-ordinates by calling <em>page.X</em> and <em>page.Y</em> builtin functions of jQuery.</li>
<li>We used <em>margin-left</em> and <em>margin-top</em> to style our DIV. Values of both margins are set equivalent of <em>page.X</em> and <em>page.Y</em></li>
<li>So, every time when mouse moves on the page<em>, </em>our DIV changes its position itself. And this all is happening because we have defined the <em>position</em> of our DIV to <em>absolute. </em>So, DIV is free to move anywhere on the page.</li>
<li>We used <em>+10</em> with <em>page.X</em> and <em>page.Y</em> its just because we wanted to move our object a little far from the cursor.</li>
<li>Our DIV has a Flash Object. And we have made this flash animation a transparent one. So, it will not hide any element on the page. Code for our DIV is below:</li>
</ol>
<pre class="brush: php; title: ; notranslate">
&lt;div id=&quot;follower&quot;&gt;
 &lt;object id=&quot;followers&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; width=&quot;250&quot; height=&quot;150&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot;&gt;
 &lt;param name=&quot;name&quot; value=&quot;follower&quot; /&gt;
 &lt;param name=&quot;align&quot; value=&quot;middle&quot; /&gt;
 &lt;param name=&quot;allowScriptAccess&quot; value=&quot;sameDomain&quot; /&gt;
 &lt;param name=&quot;allowFullScreen&quot; value=&quot;false&quot; /&gt;
 &lt;param name=&quot;quality&quot; value=&quot;high&quot; /&gt;
 &lt;param name=&quot;bgcolor&quot; value=&quot;#ffffff&quot; /&gt;
 &lt;param name=&quot;wmode&quot; value=&quot;transparent&quot; /&gt;
 &lt;param name=&quot;allowScale&quot; value=&quot;false&quot; /&gt;
 &lt;param name=&quot;src&quot; value=&quot;mouse.swf&quot; /&gt;
 &lt;param name=&quot;allowfullscreen&quot; value=&quot;false&quot; /&gt;
 &lt;embed id=&quot;followers&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;250&quot; height=&quot;150&quot; src=&quot;mouse.swf&quot; allowscale=&quot;false&quot; wmode=&quot;transparent&quot; bgcolor=&quot;#ffffff&quot; quality=&quot;high&quot; allowfullscreen=&quot;false&quot; allowscriptaccess=&quot;sameDomain&quot; align=&quot;middle&quot; name=&quot;follower&quot;&gt;&lt;/embed&gt;
 &lt;/object&gt;
&lt;/div&gt;
</pre>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7217075623453662";
google_ad_slot = "4831550702";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<center><font-size="9px">Advertisement</font></center></p>
<p>Don’t forget to share the post on your favorite website. It may also help someone somewhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techmug.com/jmouse-follower/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

