<?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>Clayton McIlrath &#187; front-end</title>
	<atom:link href="http://thinkclay.com/tag/front-end/feed" rel="self" type="application/rss+xml" />
	<link>http://thinkclay.com</link>
	<description>Creative Media Design, Powered by Wordpress</description>
	<lastBuildDate>Thu, 29 Jul 2010 18:35:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>FBJS Slider Carousel</title>
		<link>http://thinkclay.com/tutorial/fbjs-slider-carousel</link>
		<comments>http://thinkclay.com/tutorial/fbjs-slider-carousel#comments</comments>
		<pubDate>Tue, 13 Apr 2010 04:50:25 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[developer tools]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[FBJS]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[JS]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=1325</guid>
		<description><![CDATA[I&#8217;ve made a nice little FBJS Slider that I use quite often for animation within facebook. I hope that little snippets and code like this will help other developers make more interested and appealing Facebook applications, like we do at Room 214 currently. First with the styling #slideWrap creates an extremely wide canvas for the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made a nice little <strong>FBJS Slider</strong> that I use quite often for animation within facebook. I hope that little snippets and code like this will help other developers make more interested and appealing Facebook applications, like we do at <a href="http://room214.com">Room 214</a> currently.</p>
<h3>First with the styling</h3>
<p>#slideWrap creates an extremely wide canvas for the slide to fit on aligned horizontally.<br />
#wrapper then creates a sort of viewport to view the slides through.</p>
<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
<span style="color: #cc00cc;">#wrapper</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">520px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slideWrap</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">9000px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.slide</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">520px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> <span style="color: #cc00cc;">#slideNav</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-2.75em</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">2em</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#slideNav</span> li <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
		<span style="color: #cc00cc;">#slideNav</span> li a <span style="color: #00AA00;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">http://cmcilrath.rssready.net/xcel/assets/images/bg_slideNav.png?v=3</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #933;">-12px</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
			<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
			<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
			<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
			<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">.5em</span><span style="color: #00AA00;">;</span>
			<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
			<span style="color: #000000; font-weight: bold;">text-indent</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-999em</span><span style="color: #00AA00;">;</span>
			<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
		<span style="color: #00AA00;">&#125;</span>
		<span style="color: #cc00cc;">#slideNav</span> li a<span style="color: #6666ff;">.next</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#slideNav</span> li a<span style="color: #6666ff;">.prev</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
		<span style="color: #cc00cc;">#slideNav</span> li a<span style="color: #6666ff;">.selected</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-12px</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
		<span style="color: #cc00cc;">#slideNav</span> li<span style="color: #cc00cc;">#prevSlide</span> a <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
		<span style="color: #cc00cc;">#slideNav</span> li<span style="color: #cc00cc;">#prevSlide</span> a<span style="color: #6666ff;">.disabled</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
		<span style="color: #cc00cc;">#slideNav</span> li<span style="color: #cc00cc;">#nextSlide</span> a <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
		<span style="color: #cc00cc;">#slideNav</span> li<span style="color: #cc00cc;">#nextSlide</span> a<span style="color: #6666ff;">.disabled</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></div></div>
<h3>The FBJS script</h3>
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;!--</span>
<span style="color: #003366; font-weight: bold;">function</span> Each<span style="color: #009900;">&#40;</span>array<span style="color: #339933;">,</span> block<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> l <span style="color: #339933;">=</span> array.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>l<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		block<span style="color: #009900;">&#40;</span>array<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> currentSlide <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> maxSlides <span style="color: #339933;">=</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> animating <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> slideWidth <span style="color: #339933;">=</span> <span style="color: #CC0000;">520</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> currentPX <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> nextSlide<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> nextSlideNum <span style="color: #339933;">=</span> currentSlide <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>nextSlideNum <span style="color: #339933;">&gt;=</span> maxSlides<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'next'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'disable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>nextSlideNum <span style="color: #339933;">==</span> <span style="color: #CC0000;">2</span> <span style="color: #339933;">&amp;&amp;</span> currentSlide <span style="color: #339933;">==</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prev'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'enable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	currentSlide <span style="color: #339933;">=</span> nextSlideNum<span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>animating <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'right'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> prevSlide<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> prevSlideNum <span style="color: #339933;">=</span> currentSlide <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>prevSlideNum <span style="color: #339933;">==</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prev'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'disable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>currentSlide <span style="color: #339933;">==</span> maxSlides<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'next'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'enable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	currentSlide <span style="color: #339933;">=</span> prevSlideNum<span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>animating <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'left'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> toggleButton<span style="color: #009900;">&#40;</span>button<span style="color: #339933;">,</span>state<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>button <span style="color: #339933;">==</span> <span style="color: #3366CC;">'next'</span> <span style="color: #339933;">&amp;&amp;</span> state <span style="color: #339933;">==</span> <span style="color: #3366CC;">'disable'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'nextSlide'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">setInnerXHTML</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;a href=&quot;#&quot; class=&quot;next disabled&quot;&gt;next slide &amp;gt;&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span>nextSlide<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>button <span style="color: #339933;">==</span> <span style="color: #3366CC;">'next'</span> <span style="color: #339933;">&amp;&amp;</span> state <span style="color: #339933;">==</span> <span style="color: #3366CC;">'enable'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'nextSlide'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">setInnerXHTML</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;a href=&quot;#&quot; class=&quot;next&quot;&gt;next slide &amp;gt;&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span>nextSlide<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>button <span style="color: #339933;">==</span> <span style="color: #3366CC;">'prev'</span> <span style="color: #339933;">&amp;&amp;</span> state <span style="color: #339933;">==</span> <span style="color: #3366CC;">'disable'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prevSlide'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">setInnerXHTML</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;a href=&quot;#&quot; class=&quot;prev disabled&quot;&gt;&amp;lt; previous slide&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span>prevSlide<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>button <span style="color: #339933;">==</span> <span style="color: #3366CC;">'prev'</span> <span style="color: #339933;">&amp;&amp;</span> state <span style="color: #339933;">==</span> <span style="color: #3366CC;">'enable'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prevSlide'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">setInnerXHTML</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;a href=&quot;#&quot; class=&quot;prev&quot;&gt;&amp;lt; previous slide&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span>prevSlide<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> <span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span>direction<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	Each<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slideNav&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">as</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">as</span>.<span style="color: #660066;">removeClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;selected&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slideNav-&quot;</span><span style="color: #339933;">+</span>currentSlide<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;selected&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	animating <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> pixelShift <span style="color: #339933;">=</span> slideWidth <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span>currentSlide<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> startingSlideNum <span style="color: #339933;">=</span> currentSlide<span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> Slide_container <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slideWrap'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>direction <span style="color: #339933;">==</span> <span style="color: #3366CC;">'left'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		Animation<span style="color: #009900;">&#40;</span>Slide_container<span style="color: #009900;">&#41;</span>
			.<span style="color: #660066;">by</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'left'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'-'</span> <span style="color: #339933;">+</span> pixelShift <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">from</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'-'</span> <span style="color: #339933;">+</span> currentPX <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #009900;">&#41;</span>
			.<span style="color: #660066;">by</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'right'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'-'</span> <span style="color: #339933;">+</span> pixelShift <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">from</span><span style="color: #009900;">&#40;</span>currentPX <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #009900;">&#41;</span>
			.<span style="color: #660066;">duration</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">300</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ease</span><span style="color: #009900;">&#40;</span>Animation.<span style="color: #660066;">ease</span>.<span style="color: #660066;">both</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">checkpoint</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>startingSlideNum <span style="color: #339933;">==</span> currentSlide<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> animating<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
				<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'left'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">go</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>direction <span style="color: #339933;">==</span> <span style="color: #3366CC;">'right'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		Animation<span style="color: #009900;">&#40;</span>Slide_container<span style="color: #009900;">&#41;</span>
			.<span style="color: #660066;">by</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'right'</span><span style="color: #339933;">,</span> pixelShift <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">from</span><span style="color: #009900;">&#40;</span>currentPX <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #009900;">&#41;</span>
			.<span style="color: #660066;">by</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'left'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'-'</span> <span style="color: #339933;">+</span> pixelShift <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">from</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'-'</span> <span style="color: #339933;">+</span> currentPX <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #009900;">&#41;</span>
			.<span style="color: #660066;">duration</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">300</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ease</span><span style="color: #009900;">&#40;</span>Animation.<span style="color: #660066;">ease</span>.<span style="color: #660066;">both</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">checkpoint</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>startingSlideNum <span style="color: #339933;">==</span> currentSlide<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> animating<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
				<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'right'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">go</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	currentPX <span style="color: #339933;">=</span> pixelShift<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> showSlide<span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	startingSlide <span style="color: #339933;">=</span> currentSlide<span style="color: #339933;">;</span>
	currentSlide <span style="color: #339933;">=</span> num<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>num <span style="color: #339933;">&gt;</span> startingSlide<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'left'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>num <span style="color: #339933;">&lt;</span> startingSlide<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'right'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>startingSlide <span style="color: #339933;">==</span> maxSlides <span style="color: #339933;">&amp;&amp;</span> currentSlide <span style="color: #339933;">==</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'next'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'enable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prev'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'disable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>currentSlide <span style="color: #339933;">==</span> maxSlides <span style="color: #339933;">&amp;&amp;</span> startingSlide <span style="color: #339933;">==</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prev'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'enable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'next'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'disable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>currentSlide <span style="color: #339933;">==</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prev'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'disable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>currentSlide <span style="color: #339933;">==</span> maxSlides<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'next'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'disable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>startingSlide <span style="color: #339933;">==</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prev'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'enable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>startingSlide <span style="color: #339933;">==</span> maxSlides<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> toggleButton<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'next'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'enable'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #006600; font-style: italic;">//--&gt;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>
<h3>FBML Markup</h3>
<p>Simple markup here, slideNav controls the slide with onclicks, the JS does the magic.</p>
<div class="wp_syntax"><div class="code"><pre class="xhtml" style="font-family:monospace;">&lt;div id=&quot;wrapper&quot;&gt;
	&lt;h2&gt;Header&lt;/h2&gt;
	&lt;ul id=&quot;slideNav&quot;&gt;
		&lt;li id=&quot;prevSlide&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;prev disabled&quot;&gt;&amp;lt; previous slide&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;slideNav-1&quot; onclick=&quot;showSlide(1); return false;&quot; class=&quot;selected&quot;&gt;1&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;slideNav-2&quot; onclick=&quot;showSlide(2); return false;&quot;&gt;2&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;slideNav-3&quot; onclick=&quot;showSlide(3); return false;&quot;&gt;3&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;slideNav-4&quot; onclick=&quot;showSlide(4); return false;&quot;&gt;4&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;slideNav-5&quot; onclick=&quot;showSlide(5); return false;&quot;&gt;5&lt;/a&gt;&lt;/li&gt;
		&lt;li id=&quot;nextSlide&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;next&quot; onclick=&quot;nextSlide(); return false;&quot;&gt;&amp;gt;&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;div id=&quot;slideWrap&quot;&gt;
        &lt;div id=&quot;slide_1&quot; class=&quot;slide&quot;&gt;
			&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Title 1&lt;/a&gt;&lt;/h3&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
        &lt;/div&gt;
&nbsp;
        &lt;div id=&quot;slide_2&quot; class=&quot;slide&quot;&gt;
			&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Title 2&lt;/a&gt;&lt;/h3&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
        &lt;/div&gt;
&nbsp;
        &lt;div id=&quot;slide_3&quot; class=&quot;slide&quot;&gt;
			&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Title 3&lt;/a&gt;&lt;/h3&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
        &lt;/div&gt;
&nbsp;
        &lt;div id=&quot;slide_4&quot; class=&quot;slide&quot;&gt;
			&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Title 4&lt;/a&gt;&lt;/h3&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
        &lt;/div&gt;
&nbsp;
        &lt;div id=&quot;slide_5&quot; class=&quot;slide&quot;&gt;
			&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Title 5&lt;/a&gt;&lt;/h3&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
        &lt;/div&gt;
	&lt;/div&gt;
	&lt;!-- end slideWrap --&gt;
&lt;/div&gt;</pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/tutorial/fbjs-slider-carousel/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Getting Started with Facebook JS (FBJS)</title>
		<link>http://thinkclay.com/technology/getting-started-with-facebook-js-fbjs</link>
		<comments>http://thinkclay.com/technology/getting-started-with-facebook-js-fbjs#comments</comments>
		<pubDate>Thu, 25 Feb 2010 05:16:13 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[FBJS]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[JS]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=1314</guid>
		<description><![CDATA[<a href="http://thinkclay.com/technology/getting-started-with-facebook-js-fbjs"><img src="http://thinkclay.com/wp-content/uploads/2010/02/facebook-js-fbjs.jpg" alt="" title="facebook-js-fbjs" width="300" height="200" class="alignleft" /></a>
I’ve only recently started developing Facebook Apps and being a strong front-end developer I was confident that I would be able to pickup FBJS quickly. My confidence what short-lived however, once i discovered that Facebook had a very restricting framework and cache system that would make JS programming something quite a bit less desirable than awesome frameworks like jQuery.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve only recently started developing Facebook Apps and being a strong front-end developer I was very confident that I would be able to pickup FBJS quickly like I have with many other Javascript Frameworks. My confidence what short-lived however, once I discovered that Facebook had a very restricting framework and cache system that would make JS programming something quite a bit less desirable than awesome frameworks like jQuery or Prototype</p>
<h3>What you CAN&#8217;T do in FBJS</h3>
<p>I learned very quickly, that Facebook JavaScript does not allow some very common native functions such as onload, arrays and alerts as well as access to many properties of the document or window level of the DOM. There are workarounds and alternative methods that you can use instead:</p>
<h4>window.onload in FBJS</h4>
<p>Instead of using <em>window.onload</em> to initialize your functions, use <em>setTimeout</em>.</p>
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">setTimeout<span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>
<p>Even an empty setTimout at the beginning of your script will kick start your functions which would normally auto init (this seems to work fine in canvas, but not so much in tabs).</p>
<h4>alert alternative for FBJS</h4>
<p>Since you can&#8217;t use alert or document.write, use Facebook&#8217;s dialog box:</p>
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">new</span> Dialog<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">showMessage</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Dialog'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'This is text'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>
<h4>document.write alternative for FBJS</h4>
<p>Since you don&#8217;t have access to the document or window levels of the DOM, you&#8217;ll want to setup a little include for testing. I drop in this code when i want to quickly output:</p>
<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script&gt;
function logOutput(){
    var text = &quot;This will be inserted into my log div&quot;;
    document.getElementById('log').setTextValue(text);
}
&lt;/script&gt;
&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;</pre></div></div>
<h4>Trouble with JS Arrays in Facebook</h4>
<p>For whatever reason, facebook also decided to rip out support for creating objects which also eliminated the way most of us make arrays:</p>
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// new Array() is not supported in FBJS</span>
<span style="color: #003366; font-weight: bold;">var</span> myarray <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
myarray<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'stuff'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// or</span>
myarray<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'foo'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'bar'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// or </span>
myarray.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'another example'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>
<p>More to come as I wrestle further with Facebook. Any tips or comments are greatly appreciated!</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/technology/getting-started-with-facebook-js-fbjs/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Zen Coding</title>
		<link>http://thinkclay.com/technology/zen-coding</link>
		<comments>http://thinkclay.com/technology/zen-coding#comments</comments>
		<pubDate>Mon, 23 Nov 2009 20:22:13 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[developer tools]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[MAC]]></category>
		<category><![CDATA[PC]]></category>
		<category><![CDATA[semantics]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=1193</guid>
		<description><![CDATA[As a developer, I&#8217;m always looking for ways to improve my coding practices and efficiency. In the programming world, I work almost completely with frameworks such as Zend and CodeIgnitor using MVC at it&#8217;s fullest. On the front-end, I&#8217;ve learned to use Blueprint CSS combined with semantic markup to standardize my layouts. But now, I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>As a developer, I&#8217;m always looking for ways to improve my coding practices and efficiency. In the programming world, I work almost completely with frameworks such as <a href="http://www.zend.com/">Zend</a> and <a href="http://codeigniter.com/">CodeIgnitor</a> using <a href="http://www.oreillynet.com/onlamp/blog/2007/06/what_is_mvc.html">MVC</a> at it&#8217;s fullest. On the front-end, I&#8217;ve learned to use <a href="http://blueprintcss.org">Blueprint CSS</a> combined with semantic markup to standardize my layouts. But now, I&#8217;ve added another INCREDIBLE tool to my belt, and I want to share it with all of you as well.. <strong>Zen Coding</strong></p>
<h2>What is Zen Coding?</h2>
<p>From a general perspective Zen Coding is simply the practice of making lightweight and reusable code to allow for peaceful coding and debugging (that&#8217;s my definition anyways). There has been a movement in the front-end development community towards finding new ways to use <a href="http://www.csszengarden.com/">CSS with semantic markup</a> in order to produce the desired layouts and styles. Now Sergey Chikuyonok has taken that to a whole new level. He&#8217;s reversed the idea of Zen Coding using HTML markup to generate CSS Selectors and allowed us to create our markup from using CSS Selectors. This might seem confusing, so lets look at some code:</p>
<p>Plain and simply put, the Zen Coding plugin (supported on multiple text editors) translates code like this:</p>
<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">div<span style="color: #cc00cc;">#header</span><span style="color: #00AA00;">&gt;</span>ul.nav<span style="color: #00AA00;">&gt;</span>li<span style="color: #00AA00;">*</span><span style="color: #cc66cc;">5</span></pre></div></div>
<p>into this:</p>
<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;header&quot;&gt;
	&lt;ul class=&quot;nav&quot;&gt;
		&lt;li&gt;&lt;/li&gt;
		&lt;li&gt;&lt;/li&gt;
		&lt;li&gt;&lt;/li&gt;
		&lt;li&gt;&lt;/li&gt;
		&lt;li&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;</pre></div></div>
<p>.. and yet, this is still nothing folks! Dive in deeper over at <a href="http://www.smashingmagazine.com/2009/11/21/zen-coding-a-new-way-to-write-html-code/">Smashing Mag</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/technology/zen-coding/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Add, Edit, Delete Cookies with JavaScript</title>
		<link>http://thinkclay.com/technology/add-edit-delete-cookies-with-javascript</link>
		<comments>http://thinkclay.com/technology/add-edit-delete-cookies-with-javascript#comments</comments>
		<pubDate>Mon, 19 Oct 2009 19:30:55 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[programming]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=1187</guid>
		<description><![CDATA[<a href="http://thinkclay.com/wp-content/uploads/2009/10/cookie-in-js.jpg"><img src="http://thinkclay.com/wp-content/uploads/2009/10/cookie-in-js.jpg" alt="cookies in js" title="cookies in js" width="300" height="200" class="alignleft" /></a>There are many ways to communicate and store data from front-end to back-end, but many require AJAX which may take too much time to develop or might not fit the project correctly. A neat alternative to save data and be able to access that data from the server is using <strong>browser cookies</strong>. <a href="http://en.wikipedia.org/wiki/HTTP_cookie">Cookies</a> can be created and destroyed by javascript, and while the syntax can be confusing, I've gathered this little script that will make it easier to use...]]></description>
			<content:encoded><![CDATA[<p>There are many ways to communicate and store data from front-end to back-end, but many require AJAX which may take too much time to develop or might not fit the project correctly. A neat alternative to save data and be able to access that data from the server is using <strong>browser cookies</strong>. <a href="http://en.wikipedia.org/wiki/HTTP_cookie">Cookies</a> can be created and destroyed by javascript, and while the syntax can be confusing, I&#8217;ve gathered this little script that will make it easier to use:</p>
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/* COOKIES OBJECT */</span>
<span style="color: #003366; font-weight: bold;">var</span> Cookies <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// Initialize by splitting the array of Cookies</span>
	init<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> allCookies <span style="color: #339933;">=</span> document.<span style="color: #660066;">cookie</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'; '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>allCookies.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> cookiePair <span style="color: #339933;">=</span> allCookies<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'='</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#91;</span>cookiePair<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> cookiePair<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        <span style="color: #006600; font-style: italic;">// Create Function: Pass name of cookie, value, and days to expire</span>
	create<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #339933;">,</span>value<span style="color: #339933;">,</span>days<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>days<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> date <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			date.<span style="color: #660066;">setTime</span><span style="color: #009900;">&#40;</span>date.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span>days<span style="color: #339933;">*</span><span style="color: #CC0000;">24</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003366; font-weight: bold;">var</span> expires <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;; expires=&quot;</span><span style="color: #339933;">+</span>date.<span style="color: #660066;">toGMTString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #003366; font-weight: bold;">var</span> expires <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
		document.<span style="color: #660066;">cookie</span> <span style="color: #339933;">=</span> <span style="color: #000066;">name</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;=&quot;</span><span style="color: #339933;">+</span>value<span style="color: #339933;">+</span>expires<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;; path=/&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#91;</span><span style="color: #000066;">name</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> value<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        <span style="color: #006600; font-style: italic;">// Erase cookie by name</span>
	erase<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #339933;">,</span><span style="color: #3366CC;">''</span><span style="color: #339933;">,-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#91;</span><span style="color: #000066;">name</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
Cookies.<span style="color: #660066;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>
<p>Unfortunately, there&#8217;s no easy way to simple update a cookie (correct me if I&#8217;m wrong) but this will allow you to delete and re-create as needed:</p>
<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Erase cookie &quot;test&quot;</span>
Cookies.<span style="color: #660066;">erase</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'test'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Recreate cookie &quot;test&quot; with a new value of &quot;cookievalue&quot; and set to expire in 10 days</span>
Cookies.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'test'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'cookievalue'</span><span style="color: #339933;">,</span><span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span></pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/technology/add-edit-delete-cookies-with-javascript/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pros and Cons of using sIFR</title>
		<link>http://thinkclay.com/technology/pros-cons-using-sifr</link>
		<comments>http://thinkclay.com/technology/pros-cons-using-sifr#comments</comments>
		<pubDate>Wed, 22 Jul 2009 07:56:58 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[developer tools]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[web browser]]></category>
		<category><![CDATA[web standards]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=1068</guid>
		<description><![CDATA[<a href="http://thinkclay.com/technology/pros-cons-using-sifr"><img class="alignleft" src="http://thinkclay.com/wp-content/uploads/2009/07/sifr.jpg" alt="sifr" title="sifr" width="300" height="200" /></a>sIFR (scalable Inman Flash Replacement): allows for dynamically-generated snippets of text to use any font supported in Flash using a combination of JavaScript and Flash embedding to replace characters on the page.
In <a href="http://thinkclay.com/technology/cufon-sifr-flir" title="sIFR vs Cufon vs FLIR">my last post regarding sIFR</a>, I compared <strong>sIFR</strong> against <strong>Cufon</strong> and <strong>FLIR</strong>. Since there is a great deal of interest in them, I decided to go deeper into what I believe is the superior out of the three.. ]]></description>
			<content:encoded><![CDATA[<p><a href="http://thinkclay.com/technology/pros-cons-using-sifr"><img class="alignleft" src="http://thinkclay.com/wp-content/uploads/2009/07/sifr.jpg" alt="sifr" title="sifr" width="300" height="200" /></a>sIFR (scalable Inman Flash Replacement): allows for dynamically-generated snippets of text to use any font supported in Flash using a combination of JavaScript and Flash embedding to replace characters on the page. </p>
<p>In <a href="http://thinkclay.com/technology/cufon-sifr-flir" title="sIFR vs Cufon vs FLIR">my last post regarding sIFR</a>, I compared <strong>sIFR</strong> against a few of the other popular font replacement methods such as <strong>Cufon</strong> and <strong>FLIR</strong>. Since there is obviously a great deal of interest in the subject of font replacement, I figured it would be beneficial to show a deeper analysis at sIFR which I believe is the superior out of the three.</p>
<h2>A deeper look at pros of sIFR</h2>
<p>sIFR is quite different to the many font replacement techniques in the wild. Instead of manually generating each header through an image generator such as <strong>FLIR</strong> and <strong>Cufon</strong> do, sIFR is able to load a flash object and replace each element on the fly. The scripted effect works for roughly 95% of world wide web users according to statistics for Flash support and JavaScript support in modern browsers. Note also, that sIFR is by no means required, and degrades gracefully if the user does not have one of these components required. I&#8217;m sure some purists would react with contempt, but this method causes no harm to usability and only effects load time if used incorrectly (such as replacing body text rather than headers).</p>
<h2>sIFR&#8230; what&#8217;s not to love?</h2>
<p>First and foremost, implementation can be slaughtered. For an inexperienced developer, sIFR can take up to an hour to implement (from what I&#8217;ve heard in complaints anyways) and can cause pages to load slowly. From my experience, both are due to an incompetent developer, as sIFR is quite easy to implement if you understand all front-end technologies (which you should be a front-end developer) and only causes slow load time if its used for large blocks of text. Compare sIFR to the first wave of Web 2.0 technologies.. to this day I see wannabe developers implementing 20k+ javascript libraries to do one simple &#8220;jiggle&#8221; or &#8220;ajax&#8221; ability, which you can do with a few lines of code if you understand raw JavaScript. We can&#8217;t blame the technology for human error.. sIFR is brilliant. It may have a ways to go before it&#8217;s perfect, but respecting the principles of semantics, usability, and accessibility.. <strong>sIFR</strong> by far is winning the race against <strong>Cufon</strong> and <strong>FLIR</strong>.</p>
<p>Now to address the purists and their complaint about flash and JS dependency. Plain and simply, if a user falls within the 3-10% that doesn’t have Flash or JavaScript enabled, then BIG DEAL. That&#8217;s what good old HTML/CSS are for.. a fall back solution. Should we punish those with modern browsers and technologies for the minority that will get a slightly-less-quality rendering? I don&#8217;t punish modern browsers by neglecting the wonders of CSS 3. If Internet Explorer sees a box with square corners instead of rounded.. BIG DEAL. So why should we fight about whether a user has JS or Flash enabled? Heck, you can even use image replacement at that point, if you really want to. </p>
<h2>The Big Picture</h2>
<p>The real issue is that there aren’t enough fonts supported in Internet Explorer. If we want to point fingers and find something to criticize, there it is. Firefox, Safari, Chrome, Opera.. they&#8217;re all supporting more CSS properties such as <strong>@font-face</strong>. However, due to copyright laws and support from Internet Explorer we are bound to 5-10 fonts that we can reasonably assume the user has installed, and that’s ALL we&#8217;ve got. Solutions have been offered and argued but the problems are still much broader.. ranging from font licensing, support and rendering, with no clear solution in sight.</p>
<p>sIFR is one solution of many offered by developers fighting a war for creative freedom. It&#8217;s here and now, it&#8217;s legal despite the font, and regardless of the few quirks.. it’s usable. If you use it, then I hope you implement it well. If you protest it, then I hope you have valid reasons, and aren&#8217;t just complaining because you&#8217;re ignorant. Take this post with a grain of salt.. it&#8217;s my 2 cents and nothing more.</p>
<h3>Read further:</h3>
<p><a href="http://thinkclay.com/technology/cufon-sifr-flir" title="sIFR vs Cufon vs FLIR">Cufon vs sIFR vs FLIR</a><br />
<a href="http://decasa.eu/content/fonts-seo-and-compatibility-designer%E2%80%99s-dilemma">Style vs SEO</a><br />
<a href="http://www.fontembedding.com/fonts-and-the-law/">Fonts and the Law</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/technology/pros-cons-using-sifr/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where to start learning Web Development</title>
		<link>http://thinkclay.com/technology/where-to-start-learning-web-development</link>
		<comments>http://thinkclay.com/technology/where-to-start-learning-web-development#comments</comments>
		<pubDate>Thu, 11 Jun 2009 20:13:29 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[developer tools]]></category>
		<category><![CDATA[freelance]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[semantics]]></category>
		<category><![CDATA[web standards]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=1016</guid>
		<description><![CDATA[<a href="http://thinkclay.com/technology/where-to-start-learning-web-development" title="Learn Web Development"><img src="http://thinkclay.com/wp-content/uploads/2009/06/start-web-development.jpg" alt="Start Learning Web Development" title="start-web-development" width="300" height="200" class="alignleft" /></a>There are SO MANY articles out there that get very deep into <strong>web development</strong> and programming concepts, but not many people know what to start learning if you're just starting in this field. I've put together a well-rounded list of resources and websites to read on a regular basis and learn as much as you can. If you become familiar with all of these websites, you'll quickly be the best in your field. All the information is free to anyone with a passion or desire to learn.]]></description>
			<content:encoded><![CDATA[<p><a href="http://thinkclay.com/technology/where-to-start-learning-web-development" title="Learn Web Development"><img src="http://thinkclay.com/wp-content/uploads/2009/06/start-web-development.jpg" alt="Start Learning Web Development" title="start-web-development" width="300" height="200" class="alignleft" /></a>There are SO MANY articles out there that get very deep into <strong>web development</strong> and programming concepts, but not many people know what to start learning if you&#8217;re just starting in this field. I&#8217;ve put together a well-rounded list of resources and websites to read on a regular basis and learn as much as you can. If you become familiar with all of these websites, you&#8217;ll quickly be the best in your field. All the information is free to anyone with a passion or desire to learn.</p>
<h2>Validators</h2>
<ul>
<li><a href="http://www.totalvalidator.com">Total Validator</a>: simple HTML/CSS Validator with browser plugin support</li>
<li><a href="http://validator.w3.org/">W3C Validator</a>: the organization that defines markup standards, and validates according to those standards</li>
<li><a href="http://www.cynthiasays.com/">Cynthia Says</a>: screen reader which will help you with accessibility in mind</li>
</ul>
<h2>Accessibility</h2>
<ul>
<li><a href="http://www.webaim.org/intro/">WebAIM</a>: Introduction to Accessibility</li>
<li><a href="http://www.w3.org/TR/WCAG10/">WCAG</a>: Web Content Accessibility Guidelines</li>
<li><a href="http://www.w3.org/WAI/intro/wcag.php">WCAG Overview</a>: Overview of WCAG Standards</li>
<li><a href="http://www.w3.org/WAI/wcag-curric/overgid.htm">WCAG Tutorial</a>: A useful educational resource to learn the standards</li>
<li><a href="http://www.section508.gov/index.cfm?FuseAction=Content&#038;ID=11">Section 508</a>: Federal requirements for web accessibility</li>
</ul>
<h2>Javascript Libraries</h2>
<ul>
<li><a href="http://jquery.com">jQuery</a></li>
<li><a href="http://script.aculo.us">Prototype / Scriptaculous</a></li>
<li><a href="mootools.net">MooTools</a></li>
</ul>
<h2>Firefox Plugins for Developers</h2>
<ul>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/2289">CSS Validator</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/2104">CSS Viewer</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/60">Web Developer Toolbar</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1843">Firebug</a></li>
</ul>
<h2>Tutorials</h2>
<ul>
<li><a href="http://www.w3schools.com/">W3Schools</a>: Very in-depth, free tutorials on the most commonly used web markup and programming languages</li>
<li><a href="http://www.alistapart.com">A List Apart</a>: Articles and tutorials on an extensive list of topics</li>
<li><a href=" http://www.quirksmode.org/resources.html">QuirksMode</a>: Good articles and test pages concerning javascript and CSS</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/technology/where-to-start-learning-web-development/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Flash Basics: Part 1</title>
		<link>http://thinkclay.com/creativity/flash-basics-part-1</link>
		<comments>http://thinkclay.com/creativity/flash-basics-part-1#comments</comments>
		<pubDate>Wed, 27 May 2009 05:30:19 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Creativity]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[digital art]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[front-end]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=963</guid>
		<description><![CDATA[<div class="alignleft" style="padding-right: 2em;"><object height="145" width="300" type="application/x-shockwave-flash" data="http://thinkclay.com/wp-content/uploads/2009/05/bubbles.swf" id="swfceb51" style="visibility: visible;"><param name="wmode" value="window"/><param name="menu" value="false"/><param name="quality" value="high"/><param name="bgcolor" value="#FFFFFF"/></object>
<script type="text/javascript">
	swfobject.embedSWF("http://thinkclay.com/wp-content/uploads/2009/05/bubbles.swf", "swfceb51", "300", "145", "9.0.0", "", {}, {wmode: "window", menu: "false", quality: "high", bgcolor: "#FFFFFF"}, {});
</script></div>A tutorial and explanation of Adobe Flash basics, understanding palletes and layout of the program. This tutorial will also walk step-by-step through actionscript and how actionscript is integrated into a flash animation using symbols and objects.]]></description>
			<content:encoded><![CDATA[<p>
<object width="490" height="237">
<param name="movie" value="http://thinkclay.com/wp-content/uploads/2009/05/bubbles.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="490" height="237" src="http://thinkclay.com/wp-content/uploads/2009/05/bubbles.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
<p>For too long I&#8217;ve put off learning Flash because I never liked the layout of the program, but I decided today that like it or not, flash is a very popular front-end development tool. Being a front-end developer it&#8217;s important to know every tool and technology to some extent and understand the inner workings of each technology and how to integrate them with other markup and programming. So let&#8217;s dive into some screenshots and descriptions and learn Adobe Flash.</p>
<h2>Getting to know the program</h2>
<p><a href="http://thinkclay.com/creativity/flash-basics-part-1/attachment/screenshot-palletes" rel="attachment wp-att-971"><img src="http://thinkclay.com/wp-content/uploads/2009/05/screenshot-palletes-640x360.jpg" alt="Flash Layout" title="Screenshot with Descriptions of Flash Palletes" width="490" /></a></p>
<h2>Create a new Flash File (Actionscript 3.0)</h2>
<ul>
<li>Create a new Flash File by going to File > New > Flash File (Actionscript 3.0)</li>
<li>Change the document size and frame rate to your liking (Modify > Document), I used 640 x 310 and 18 fps</li>
<li>Use the Rectangle tool and draw a rectangle on Layer 1 with the color you&#8217;d like</li>
<li>Create any other layers or draw any other objects or place text. I created a text object on top of the rectangle</li>
<li>Name &#8220;Layer 1&#8243; to &#8220;Background&#8221; and create a new layer named &#8220;Code&#8221;</li>
<li>Save the Document</li>
</ul>
<h2>Create a new Actionscript File</h2>
<p><a href="http://thinkclay.com/creativity/flash-basics-part-1/attachment/new-actionscript-file" rel="attachment wp-att-974"><img src="http://thinkclay.com/wp-content/uploads/2009/05/new-actionscript-file-640x360.jpg" alt="Create a new Actionscript File" title="Create a new Actionscript File" width="490" /></a></p>
<h3>Paste in the code</h3>
<p><a href="http://thinkclay.com/creativity/flash-basics-part-1/attachment/paste-code" rel="attachment wp-att-975"><img src="http://thinkclay.com/wp-content/uploads/2009/05/paste-code-640x360.jpg" alt="Paste in the Code" title="Paste in the Actionscript Code" width="490" /></a></p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/* Blurry Lights Animation */</span>
&nbsp;
<span style="color: #9900cc; font-weight: bold;">package</span> Classes
<span style="color: #000000;">&#123;</span>
	<span style="color: #3f5fbf;">/* Import required classes */</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">MovieClip</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span>.<span style="color: #004993;">BitmapFilter</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span>.<span style="color: #004993;">BlurFilter</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Lights extends <span style="color: #004993;">MovieClip</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #3f5fbf;">/* Vars */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> lightsNumber<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> xSpeed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> ySpeed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> lightsDir<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> areaW<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> areaH<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> lights<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
		<span style="color: #3f5fbf;">/* Main function */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span>areaWidth<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, areaHeight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, numberOfLights<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, lightSize<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, lightColor<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>, minimumScale<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>, hSpeed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, vSpeed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, dir<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>, <span style="color: #004993;">quality</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #3f5fbf;">/* Set variables */</span>
			areaW = areaWidth;
			areaH = areaHeight;
			lightsNumber = numberOfLights;
			lightsDir = dir;
&nbsp;
			<span style="color: #3f5fbf;">/* Use a for to create the parameter-specified number of lights*/</span>
			<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> numberOfLights; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #3f5fbf;">/* Create the specified number of lights */</span>
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> light<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Set random speed to x and y based on the params*/</span>
&nbsp;
				xSpeed = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span>hSpeed <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000; font-weight: bold;">-</span>hSpeed <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight: bold;">-</span>hSpeed<span style="color: #000000;">&#41;</span>;
				ySpeed = <span style="color: #004993;">Math</span>.<span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> vSpeed<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">0.5</span><span style="color: #000000;">&#41;</span>;
&nbsp;
				light.xSpeed = xSpeed;
				light.ySpeed = ySpeed;
&nbsp;
				<span style="color: #3f5fbf;">/* Create lights */</span>
&nbsp;
				light.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>lightColor<span style="color: #000000;">&#41;</span>;
				light.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">drawCircle</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #000000; font-weight:bold;">0</span>, lightSize <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				light.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Set a position based on the params specified */</span>
&nbsp;
				light.<span style="color: #004993;">x</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> areaWidth<span style="color: #000000;">&#41;</span>;
				light.<span style="color: #004993;">y</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> areaHeight<span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Add blur, we declare the var here to get a new blur w/every light */</span>
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">b</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">5</span>;
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> blur<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapFilter</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">BlurFilter</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">b</span>,<span style="color: #004993;">b</span>,<span style="color: #004993;">quality</span><span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> filterArray<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span>blur<span style="color: #000000;">&#41;</span>;
&nbsp;
				light.<span style="color: #004993;">filters</span> = filterArray;
&nbsp;
				<span style="color: #3f5fbf;">/* Change alpha */</span>
&nbsp;
				light.<span style="color: #004993;">alpha</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">0.6</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">0.1</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Scale */</span>
&nbsp;
				light.<span style="color: #004993;">scaleX</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000000; font-weight: bold;">-</span> minimumScale<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> minimumScale<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">100</span>;
				light.<span style="color: #004993;">scaleY</span> = light.<span style="color: #004993;">scaleX</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Add the lights */</span>
&nbsp;
				<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>light<span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Store lights in an array to use it later */</span>
&nbsp;
				lights.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>light<span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Check for lights direction */</span>
&nbsp;
				checkDirection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/* Check direction */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> checkDirection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> lights.<span style="color: #004993;">length</span>; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">switch</span> <span style="color: #000000;">&#40;</span> lightsDir <span style="color: #000000;">&#41;</span>
				<span style="color: #000000;">&#123;</span>
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;up&quot;</span> <span style="color: #000000; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, moveUp<span style="color: #000000;">&#41;</span>;
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span>;
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;down&quot;</span> <span style="color: #000000; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, moveDown<span style="color: #000000;">&#41;</span>;
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span>;
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;right&quot;</span> <span style="color: #000000; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, moveRight<span style="color: #000000;">&#41;</span>;
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span>;
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;left&quot;</span> <span style="color: #000000; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, moveLeft<span style="color: #000000;">&#41;</span>;
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span>;
					<span style="color: #0033ff; font-weight: bold;">default</span> <span style="color: #000000; font-weight: bold;">:</span>
&nbsp;
						<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Something weird just happened!&quot;</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/* Move Up function */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moveUp<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span>= e.<span style="color: #004993;">target</span>.xSpeed;
			e.<span style="color: #004993;">target</span>.y<span style="color: #000000; font-weight: bold;">-</span>=e.<span style="color: #004993;">target</span>.ySpeed;
&nbsp;
			<span style="color: #3f5fbf;">/* Reset light position, Y first, then X  */</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = areaH <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaW<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = areaH <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/* Move Down function */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moveDown<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">+</span>=e.<span style="color: #004993;">target</span>.xSpeed;
			e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">+</span>=e.<span style="color: #004993;">target</span>.ySpeed;
&nbsp;
			<span style="color: #3f5fbf;">/* Reset light position, Y first, then X */</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaH<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaW<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = areaH <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/* Move Right function */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moveRight<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">+</span>=e.<span style="color: #004993;">target</span>.ySpeed;
			e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">+</span>=e.<span style="color: #004993;">target</span>.xSpeed;
&nbsp;
			<span style="color: #3f5fbf;">/* Reset light position, Y first, then X */</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaH <span style="color: #000000; font-weight: bold;">||</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaH<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaW<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/* Move Left function */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moveLeft<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e.<span style="color: #004993;">target</span>.x<span style="color: #000000; font-weight: bold;">-</span>=e.<span style="color: #004993;">target</span>.ySpeed;
			e.<span style="color: #004993;">target</span>.y<span style="color: #000000; font-weight: bold;">-</span>=e.<span style="color: #004993;">target</span>.xSpeed;
&nbsp;
			<span style="color: #3f5fbf;">/* Reset light position, Y first, then X */</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaH <span style="color: #000000; font-weight: bold;">||</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> = areaW <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaH<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> = areaW <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>
<ul>
<li>Note the line &#8220;package Classes&#8221; near the top. This is the name of the folder that will contain your class file. Make sure you have this folder in the same directory as your other flash file and that the name of the folder matches the name of the package.</li>
<li>Save the file inside your &#8220;Classes&#8221; directory</li>
</ul>
<h3>Add your Actions to your Flash File</h3>
<p>You&#8217;ve created the ActionScript file and <em>Lights</em> class, now all you need to do is call that class and pass the parameters to the script. Do this by going to Window > Actions and pasting in the code. Save and preview / publish and you&#8217;re done!</p>
<p><a href="http://thinkclay.com/creativity/flash-basics-part-1/attachment/flash-actions-properties" rel="attachment wp-att-976"><img src="http://thinkclay.com/wp-content/uploads/2009/05/flash-actions-properties-640x360.jpg" alt="Window &gt; Actions" title="Flash - Add your actions to your flash document" width="490" /></a></p>
<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> Classes.Lights;
&nbsp;
  <span style="color: #6699cc; font-weight: bold;">var</span> light<span style="color: #000000; font-weight: bold;">:</span>Lights = <span style="color: #0033ff; font-weight: bold;">new</span> Lights<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
  light.<span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">640</span>, <span style="color: #000000; font-weight:bold;">310</span>, <span style="color: #000000; font-weight:bold;">10</span>, <span style="color: #000000; font-weight:bold;">300</span>, 0xFFFFFF, <span style="color: #000000; font-weight:bold;">0.5</span>, <span style="color: #000000; font-weight:bold;">1</span>, <span style="color: #000000; font-weight:bold;">1</span>, <span style="color: #990000;">&quot;up&quot;</span>, <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
&nbsp;
  <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>light<span style="color: #000000;">&#41;</span>;</pre></div></div>
<h2>Want more?</h2>
<p><a href="http://flash.tutsplus.com/tutorials/effects/create-a-whimsical-animated-flash-background/">Read more of the programming side</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/creativity/flash-basics-part-1/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Site Redesign of Chosen Development</title>
		<link>http://thinkclay.com/creativity/website-design-chosen-development</link>
		<comments>http://thinkclay.com/creativity/website-design-chosen-development#comments</comments>
		<pubDate>Thu, 14 May 2009 21:18:09 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Creativity]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[graphic design]]></category>
		<category><![CDATA[personal]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=930</guid>
		<description><![CDATA[<a href="http://chosendevelopment.com" rel="dofollow" title="Chosen Development"><img class="alignleft" src="http://thinkclay.com/timthumb.php?src=/wp-content/uploads/2009/05/chosen-development.png&#038;w=300&#038;h=200&#038;zc=1" alt="Screenshot of ChosenDevelopment.com" title="Chosen Development - Website Design" width="300" height="200" /></a>Love it or hate it, I re-designed the Chosen Development website. I was growing tired of the Organic theme that I had developed for it originally. Though it was highly creative, it was too busy. I decided to go with a simple layout, color scheme and dark style. This a typical style for me, but I'm proud of that. Chosen development consists mostly of the work of myself and <a href="http://shanestrong.com" rel="dofollow" title="Lansing Web Developer">Shane</a> who loves the new design also. I've also integrated our new <a href="http://client.bychosen.com/interview" title="Chosen Creative Brief Interview">Creative Brief Interview</a> so that we can automate the initial research and gathering phase.]]></description>
			<content:encoded><![CDATA[<p><a href="http://chosendevelopment.com" rel="dofollow" title="Chosen Development"><img src="http://thinkclay.com/wp-content/uploads/2009/05/chosen-development-640x335.png" alt="Screenshot of ChosenDevelopment.com" title="Chosen Development - Website Design" width="490" /></a></p>
<p>Love it or hate it, I re-designed the Chosen Development website. I was growing tired of the Organic theme that I had developed for it originally. Even though it was highly creative and artistic, it was too busy and the colors were too bleh. I decided to go with a VERY simple layout, color scheme and dark, web 2.0 style. This a typical style for me, but I&#8217;m proud of that. Chosen development consists mostly of the work of myself and my business partner, <a href="http://shanestrong.com" rel="dofollow" title="Lansing Web Developer">Shane</a> and he loves the new design as well. I&#8217;ve also integrated our new <a href="http://client.bychosen.com/interview" title="Chosen Creative Brief Interview">Creative Brief Interview</a> so that we can automate the initial research and gathering phase.</p>
<p>So check it out, and give me some feedback either way!</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/creativity/website-design-chosen-development/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Makes You Stand Out</title>
		<link>http://thinkclay.com/technology/what-makes-you-stand-out</link>
		<comments>http://thinkclay.com/technology/what-makes-you-stand-out#comments</comments>
		<pubDate>Tue, 14 Apr 2009 05:44:26 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[developer tools]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[freelance]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[goals]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web 2.0]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=843</guid>
		<description><![CDATA[<a rel="shadowbox[post-843];player=img;" href="http://thinkclay.com/technology/what-makes-you-stand-out"><img width="300" height="200" class="alignleft" title="What makes YOU stand out" alt="An image of Waldo from Where's Waldo" src="http://thinkclay.com/wp-content/uploads/2009/04/waldo.jpg"/></a>Combining a poor economy with an ever changing web makes it challenging to stay on the cutting edge. With multiple web languages, platforms, and techniques it’s important to dedicate your time to being versatile and flexible while not wasting time learning skills that you won’t use. In the past 2 years I have learned and mastered many tools and techniques, and I’m here to share what has been valuable and where you can trim the fat from your day.]]></description>
			<content:encoded><![CDATA[<p><a href="http://thinkclay.com/wp-content/uploads/2009/04/waldo.jpg"><img class="alignleft" src="http://thinkclay.com/wp-content/uploads/2009/04/waldo.jpg" alt="An image of Waldo from Where&#039;s Waldo" title="What makes YOU stand out" width="300" height="200" class="size-full wp-image-844" /></a>Combining a poor global state of economic growth with an always changing web, makes a challenging formula for staying on the cutting edge and being successful in the web industry. With multiple web languages, platforms, and techniques it&#8217;s important to dedicate your time to being versatile and flexible while not wasting time learning skills that you won&#8217;t use. In the past 2 years I have learned and mastered many tools and techniques, and I&#8217;m here to share what has been valuable and where you can trim the fat from your day.</p>
<h2>Find your strengths and excel above the rest</h2>
<p>So many web developers claim to know all when it comes to web, but when put to the test someone that can write &#8220;hello world&#8221; doesn&#8217;t meet the standards the client expected when they said &#8220;Do you know PHP?&#8221; All developers whether primarily front-end or back-end, should know at least a C level amount in both. To be an awesome back-end developer you need to be able to structure your content in something other than tables or invalid HTML, and to be an awesome back-end developer, you should at least know how to make simple variables and includes to make your job quick and efficient, rather than copying/pasting your doctype and head information on each page. If you want to do well in the next few years, then succeed by being a GURU in at least two of the following: </p>
<ul>
<li><strong>XHTML and CSS</strong> &#8211; with clean and valid markup that works in FF, Webkit, and IE7+</li>
<li><strong>Flex and ActionScript</strong> &#8211; flash/animation/design are a huge plus</li>
<li><strong>JavaScript</strong> &#8211; with and without frameworks, jQuery or MooTools knowledge a plus</li>
<li><strong>PHP</strong> &#8211; cakePHP or codeignitor frameworks will take you to the next level</li>
<li><strong>.NET</strong> &#8211; IIS and server administration a plus</li>
<li><strong>Ruby</strong> &#8211; Rails will take you to the next level</li>
<li><strong>JAVA</strong> &#8211; desktop publishing knowledge a plus</li>
</ul>
<h2>Learn new and trendy technologies</h2>
<p>While following trends isn&#8217;t always a good idea, trends that have been around for more than just a year and have high demand are usually worth taking a second glance at. In the past 5 years, there are a few major trends that are really growing. I highly recommend picking one of the trends and learning as much as you can about the technology on the side of your current studies and work..</p>
<h3>Rich Internet Applications (RIA)</h3>
<p>Adobe Flash has always had a strong presence on the web, and that presence is only increasing along with other RIA platforms like Microsoft Silverlight, JavaFX, and the future HTML5. There are almost no major disadvantages to sites built entirely in Flash or other platforms now that search engines like Google are making more of an effort to index RIA content. To top that, Adobe has now adopted a markup language geared more towards developers called FLEX. Flex allows developers to markup their code in MXML while also using ActionScript for animation and then simply, with the click of a button plublish the application in either a SWF for web or as an AIR application for desktop. I strongly believe this is the future of not only the web, but future Operating Systems as well. Google and Ubuntu have already shown a heavy interest in using web applications on the desktop, and phone operating systems are following a similar pattern. While mobile and desktop development are entirely different from web development, learning FLEX is a great way for web developers to cross that threshold and succeed.</p>
<h3>Agile Development and Object Oriented code</h3>
<p>As the internet reaches the far corners of the Earth, boundaries and barriers are being broken for working remotely on projects. In fact there are many businesses that operate entirely on remote collaboration. This means you need to learn a versioning software and systems (CVS or SVN using Tortoise is a good place to start), how to organize your thoughts and communicate them quickly and effectively over IM or email, and most importantly how to comment and structure your code (for programmers OO principles are a must) so that others can quickly pickup where you left off.</p>
<h3>Web Services and Cross-Platform Markup</h3>
<p>UML, XML, JSON, REST and SOAP, just to name the most common languages, are becoming a must for nearly every developer. Almost every RIA and API use a language like this to communicate. Any site that is dynamic is probably using at least one of these technologies. I can&#8217;t specifically tell you which is more relevant or popular, as it varies per project, but I can tell you that they&#8217;re all fairly simple to learn, so I suggest doing your homework or ready a book on each to know at least base knowledge and markup for each of them.</p>
<h2>Refine your Interpersonal Communication Skills</h2>
<p>As you climb the corporate ladder, or step out into the world of business, it will become more and more important that your written and verbal communication skills are sharp and effective. The gap that used to exist between sales/consulting/design/IT is now closing, and more businesses are switching to an Agile model. This means from the start of a project or team, you may be communicating directly with a client, or with others that don&#8217;t know or understand the technology. You&#8217;ll need to learn how to explain things so that others can easily understand and relate, as well as sound professional and well educated. These skills are not easy to hone, and require a lot of time. I highly recommend actively getting involved in forums/blogging to improve written communication, perhaps join a local business group or Chamber of Commerce to learn how to communicate better in a professional business setting (another perk to this is the networking), and ask others to correct and help you identify bad habits and mistakes.</p>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/technology/what-makes-you-stand-out/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Cufon vs sIFR vs FLIR</title>
		<link>http://thinkclay.com/technology/cufon-sifr-flir</link>
		<comments>http://thinkclay.com/technology/cufon-sifr-flir#comments</comments>
		<pubDate>Fri, 10 Apr 2009 03:03:57 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[developer tools]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[semantics]]></category>
		<category><![CDATA[web browser]]></category>
		<category><![CDATA[web standards]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=827</guid>
		<description><![CDATA[<a title="Cufon SIFR FLIR" href="http://thinkclay.com/technology/cufon-sifr-flir"><img width="300" height="200" class="alignleft" title="sifr flir cufon" alt="SIFR FLIR Cufon" src="http://thinkclay.com/wp-content/uploads/2009/04/sifr-flir-cufon.jpg"/></a>In the past few years we’ve seen a growing trend towards forcing new typefaces on the web. CSS defines a property for browsers to support a property called <a href="http://www.w3.org/TR/css3-webfonts/">@font-face</a> which lets the developer define new typefaces and include the original font file for the browser to download and render the site with. Support for this feature has been implemented in Safari and is due to release with the next versions of Firefox and Opera...]]></description>
			<content:encoded><![CDATA[<p><a title="Cufon SIFR FLIR" href="http://thinkclay.com/technology/cufon-sifr-flir"><img class="alignleft" title="sifr flir cufon" src="http://thinkclay.com/wp-content/uploads/2009/04/sifr-flir-cufon.jpg" alt="SIFR FLIR Cufon" width="300" height="200" /></a>Typography is a very important element to design, and it&#8217;s quite a shame that for the past decade we&#8217;ve resorted to using images to display this element, without having the flexibility to define different fonts outside of the 13 or so <a href="http://www.ampsoft.net/webdesign-l/WindowsMacFonts.html">web safe fonts</a>. In the past few years, however, we&#8217;ve seen a growing trend towards forcing new typefaces on the web. CSS defines a property for browsers to support a property called <a href="http://www.w3.org/TR/css3-webfonts/">@font-face</a> which lets the developer define new typefaces and include the original font file for the browser to download and render the site with. Support for this feature has been implemented in Safari already and is due to release with the next versions of Firefox and Opera. Though this is definitely good news and progress in the right direction, a few issues stand in the way:</p>
<ul>
<li>Copyright is an issue for downloading and sharing fonts via the font-face attribute</li>
<li>Internet Explorer 6-8 do not support font-face</li>
<li>Font-face could potentially pose a threat if malicious sites attach/spread viruses via the font files</li>
</ul>
<p>Until <strong>font-face</strong> is fully adopted, web developers must resort to complimentary or supplementary solutions to make non-traditional typefaces work. There are few major flash and javascript solutions in existence that offer solutions with different approaches to displaying these typefaces. The three major typeface scripts that I am going to discuss are <a href="http://www.mikeindustries.com/blog/sifr/">SIFR</a>, <a href="http://facelift.mawhorter.net/examples/">FLIR</a>, and <a href="http://cufon.shoqolate.com/generate/">Cufón</a>. Before diving into details about each I&#8217;d like to point out that all of these solutions that I discuss are 100% SEO friendly, and all require JavaScript (and flash in the case of SIFR) but degrade to standard markup if JS is not enabled, also note that each of these play well with jQuery.</p>
<h2>SIFR (Scalable Inman Flash Replacement)</h2>
<p>First I must address the acronym, thought not the most relevant seeming, &#8220;Inman&#8221; is referring to <a href="http://www.shauninman.com/">Shaun Inman</a> who originally conceived the idea of using the DOM and Flash together to support non-traditional typefaces. SIFR uses a flash object to render to the font face, and then Javascript to identify the DOM and replace the text as specified.</p>
<h3>Pros of SIFR</h3>
<ul>
<li>Text can be selected</li>
<li>Does not violate EULA or copyrights, since font is contained within the SWF object</li>
<li>You can easily add shadows, anti-aliasing, and other text effects in Flash</li>
</ul>
<h3>Cons of SIFR</h3>
<ul>
<li>Slightly slower load times</li>
<li>Requires both JavaScript and Flash to be enabled</li>
</ul>
<h3>My thoughts on SIFR</h3>
<p>Some people complain that SIFR is harder to implement, but if you&#8217;re a front-end web developer it&#8217;s vital to learn and master new technologies including really basic flash. All you have to do is open the flash file included in the zip, change the font of the text to the font you want to use, and then publish it. Instructions are included on how to do this and if it is &#8220;too challenging&#8221; than you&#8217;re in the wrong field!</p>
<p>Many have also commented and argued that SIFR is no more secure to stealing a font file and using it on your website. While I do agree with that statement, the issue is a legal matter. Like it or not, and argue it as you may, Adobe Flash is legally allowed to embed and use fonts that the developer has purchased. This is not true for any of the others.</p>
<h2>FLIR (Face Lift Image Replacement)</h2>
<p>Using PHP (and the GD library) FLIR renders text into a font of your choice by reading the text in a DOM and sending a request to the server with that string and returning an image of that text rendered in the new font. It&#8217;s a very clever idea, and works behind the scenes, but it&#8217;s not without it&#8217;s quirks.</p>
<h3>Pros of FLIR</h3>
<ul>
<li>Does not violate EULA or copyrights, since font is rendered as an image</li>
<li>Prints in the font rendered since it is an image</li>
</ul>
<h3>Cons of FLIR</h3>
<ul>
<li>Requires PHP with the GD enabled</li>
<li>Text cannot be selected</li>
</ul>
<h3>My thoughts on FLIR</h3>
<p>While FLIR is fast and efficient with few flaws, one restriction I cannot overlook is the requirement for PHP and GD on the server. Many corporate websites (addressing the big guys, not the freelancers with this one) work exclusively with .NET on Windows/IIS servers without PHP installed at all. This eliminates FLIR from the mix for many websites unfortunately. In addition, FLIR disables the user to be able to select text. This is not a huge draw back if used on headings, but if used on a even body of text then you&#8217;re killing usability.</p>
<h2>Cufon</h2>
<p>Cufon is basically a new and improved version of <a href="http://typeface.neocracy.org/">Typeface.js</a>, with a focus on faster and easier implementation. Cufon uses the browser to draw vector objects using VML (Vector Markup Language) for Internet Explorer and the HTML 5 Canvas element for the more advanced browsers.</p>
<h3>Pros of Cufon</h3>
<ul>
<li>Faster load times than SIFR and FLIR, since it is all JS and nothing more</li>
<li>Has all the strengths of Typeface.js with fewer weaknesses.</li>
</ul>
<h3>Cons of Cufon</h3>
<ul>
<li>Violates EULA and copyrights due to fonts being embedded. Not many fonts are permitted to be rendered with this method</li>
<li>Text cannot be selected</li>
<li>You can&#8217;t apply a hover state to converted text</li>
</ul>
<h3>My thoughts on Cufon</h3>
<p>For many, Cufon is the best solution to work with. It allows for rendering on the fly, and works well for a developer to match a design without having to replace each heading with an image. Cufon even works quickly with large bodies of text! One thing I remain disappointed about is text selection; if this library aims to provide a solution for larger bodies of text, then it seems that text selection is a must.</p>
<p>As I have tested and worked with Cufon, I recommend it for the developer looking for a quick solution but only for personal or non-profit website. I&#8217;ve talked with a few professionals including a lawyer and confirmed that Cufon is not a legal solution for font-embedding on ANY website, but that unless you&#8217;re developing a large profile commercial site, you should be safe to use it freely.</p>
<p>If you&#8217;d like to learn more about Cufon, check out the <a href="http://net.tutsplus.com/videos/screencasts/the-easiest-way-to-use-any-font-you-wish/" rel="external">tutorial on TutsPlus</a>.</p>
<h3>Read further:</h3>
<p><a href="http://thinkclay.com/technology/cufon-sifr-flir" title="sIFR vs Cufon vs FLIR">Cufon vs sIFR vs FLIR</a><br />
<a href="http://decasa.eu/content/fonts-seo-and-compatibility-designer%E2%80%99s-dilemma">Style vs SEO</a><br />
<a href="http://www.fontembedding.com/fonts-and-the-law/">Fonts and the Law</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/technology/cufon-sifr-flir/feed</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
	</channel>
</rss>
