<?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>Sat, 15 Oct 2011 19:40:31 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>Tip of the Day: CSS Formatting</title><link>http://thinkclay.com/technology/tip-of-the-day-css-formatting</link> <comments>http://thinkclay.com/technology/tip-of-the-day-css-formatting#comments</comments> <pubDate>Wed, 07 Sep 2011 04:56:31 +0000</pubDate> <dc:creator>Clay McIlrath</dc:creator> <category><![CDATA[Technology]]></category> <category><![CDATA[best practices]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[front-end]]></category> <category><![CDATA[Tip of the Day]]></category> <category><![CDATA[web standards]]></category> <guid
isPermaLink="false">http://thinkclay.com/?p=1526</guid> <description><![CDATA[One thing I really hate about agile front-end dev is the lack of formatting standards between devs. Some developers block their rules, others keep everything on one line. Some indent their rules, others don&#8217;t. The list goes on and on. I have a list of formatting rules that my team has adopted and all the [...]]]></description> <content:encoded><![CDATA[<p>One thing I really hate about agile front-end dev is the lack of formatting standards between devs. Some developers block their rules, others keep everything on one line. Some indent their rules, others don&#8217;t. The list goes on and on. I have a list of formatting rules that my team has adopted and all the front-end devs that I respect also follow, so if you care about improving your code and agile development, please adopt a standard of some sort and stand firm by it:</p><h3>Block vs Single Line</h3><p>Default to single line, because many rules will only contain one or two styles and its a waste and pain to scroll vertically through code. Most editors support the 80 column rule, so if your styles get longer than that, convert to block (easy to set a macro to do it for you in most IDE&#8217;s and editors).</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.foo</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ccc</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;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.bar</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">pointer</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;">29px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span> <span style="color: #cc66cc;">0</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: #933;">16.2%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">26px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div><h3>Indentation</h3><p>It&#8217;s so much easier to read code that is indented to show hierarchy and white space that separates or groups similar or related objects together. This is a standard I see most front-end developers following, but if you&#8217;re not, smack yourself now and get with the program.</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;">ul <span style="color: #00AA00;">&#123;</span> <span style="color: #00AA00;">&#125;</span>
	li <span style="color: #00AA00;">&#123;</span> <span style="color: #00AA00;">&#125;</span>
		li a <span style="color: #00AA00;">&#123;</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.foo</span> <span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #6666ff;">.bar</span> <span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span></pre></div></div><p>That&#8217;s all on formatting for now. Adopt these standards and read on, because I&#8217;m sure I&#8217;ll be back on this rant before too long.</p> ]]></content:encoded> <wfw:commentRss>http://thinkclay.com/technology/tip-of-the-day-css-formatting/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Tip of the Day: Mobile Touch Events</title><link>http://thinkclay.com/technology/tip-of-the-day-mobile-touch-events</link> <comments>http://thinkclay.com/technology/tip-of-the-day-mobile-touch-events#comments</comments> <pubDate>Tue, 30 Aug 2011 00:17:54 +0000</pubDate> <dc:creator>Clay McIlrath</dc:creator> <category><![CDATA[Technology]]></category> <category><![CDATA[best practices]]></category> <category><![CDATA[front-end]]></category> <category><![CDATA[iOS]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[JS]]></category> <category><![CDATA[Mobile]]></category> <category><![CDATA[Tip of the Day]]></category> <category><![CDATA[web browser]]></category> <guid
isPermaLink="false">http://thinkclay.com/?p=1521</guid> <description><![CDATA[I recently got into a project that was a bit over my head. I had to build out a map that will work on desktop, mobile and tablets the same, but I quickly ran into issues tracking touch events in mobile Safari. All of the testing I was doing in iOS5 (beta) was working the [...]]]></description> <content:encoded><![CDATA[<p>I recently got into a project that was a bit over my head. I had to build out a map that will work on desktop, mobile and tablets the same, but I quickly ran into issues tracking touch events in mobile Safari. All of the testing I was doing in iOS5 (beta) was working the exact same way as the browser, where I could monitor a click and drag (touchmove) event and get the properties <em>pageX</em> and <em>pageY</em> directly from the event. However, on other mobile browsers (specifically iOS4 and older) this property was returning 0 everytime. I then found that multi-touch events store each finger press so I had to get the array of fingers and return the page coordinates. Long story short, here is the code I ended up implementing:</p><div
class="wp_syntax"><div
class="code"><pre class="javascript" style="font-family:monospace;">document.<span style="color: #660066;">ontouchstart</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>e<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>e.<span style="color: #660066;">touches</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// Only deal with one finger</span>
		<span style="color: #003366; font-weight: bold;">var</span> touch <span style="color: #339933;">=</span> e.<span style="color: #660066;">touches</span><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: #006600; font-style: italic;">// Get information for finger #1</span>
		    x <span style="color: #339933;">=</span> touch.<span style="color: #660066;">pageX</span><span style="color: #339933;">,</span>
		    y <span style="color: #339933;">=</span> touch.<span style="color: #660066;">pageY</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><h3>Further Reading on Mobile Touch Events in Javascript</h3><ul><li><a
href="http://www.sitepen.com/blog/2008/07/10/touching-and-gesturing-on-the-iphone/">iPhone Gesturing Explained</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://thinkclay.com/technology/tip-of-the-day-mobile-touch-events/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Tip of the Day: CSS Border Radius</title><link>http://thinkclay.com/technology/tip-of-the-day-css-border-radius</link> <comments>http://thinkclay.com/technology/tip-of-the-day-css-border-radius#comments</comments> <pubDate>Mon, 29 Aug 2011 05:05:46 +0000</pubDate> <dc:creator>Clay McIlrath</dc:creator> <category><![CDATA[Technology]]></category> <category><![CDATA[best practices]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[developer tools]]></category> <category><![CDATA[front-end]]></category> <category><![CDATA[Tip of the Day]]></category> <category><![CDATA[web standards]]></category> <guid
isPermaLink="false">http://thinkclay.com/?p=1517</guid> <description><![CDATA[Too often I look at code where developers aren&#8217;t keeping up with standards and browser adoption and compatibility. This tip will save you from writing a bunch of browser prefixes and thus writing extra, redundant code. As of the date of this posting the latest versions of Opera, Firefox, Chrome and Safari all support &#8220;border-radius&#8221; [...]]]></description> <content:encoded><![CDATA[<p>Too often I look at code where developers aren&#8217;t keeping up with standards and browser adoption and compatibility. This tip will save you from writing a bunch of browser prefixes and thus writing extra, redundant code. As of the date of this posting the latest versions of Opera, Firefox, Chrome and Safari all support &#8220;border-radius&#8221; without a prefix. I&#8217;ve confirmed this on <a
href="http://css3.info">http://css3.info</a> though I&#8217;m not sure what the latest adoption by IE9 is.</p><p>Also, for those that will rebuttal and argue that older versions of these browsers don&#8217;t support it, to you I&#8217;d say look up the statistics of old versions of these browsers being out in the wild and stuff it please, because the percentage of users that don&#8217;t upgrade these browsers is so low and insignificant that I really don&#8217;t want to hear the argument <img
src='http://thinkclay.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>That concludes today&#8217;s &#8220;Tip of the Day&#8221; check back again tomorrow!</p> ]]></content:encoded> <wfw:commentRss>http://thinkclay.com/technology/tip-of-the-day-css-border-radius/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Introduction to Flash and ActionScript</title><link>http://thinkclay.com/creativity/introduction-flash-actionscript</link> <comments>http://thinkclay.com/creativity/introduction-flash-actionscript#comments</comments> <pubDate>Sun, 27 Feb 2011 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[flex]]></category> <category><![CDATA[front-end]]></category> <guid
isPermaLink="false">http://thinkclay.com/?p=963</guid> <description><![CDATA[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
name="quality" value="high"><param
name="wmode" value="window"><param
name="menu" value="false"><param
name="bgcolor" value="#FFFFFF"><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"> </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/introduction-flash-actionscript/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/introduction-flash-actionscript/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/introduction-flash-actionscript/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: #009966; font-style: italic;">/* Import required classes */</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MovieClip</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">BitmapFilter</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">BlurFilter</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Lights <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">MovieClip</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #009966; font-style: italic;">/* Vars */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> lightsNumber<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> xSpeed<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> ySpeed<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> lightsDir<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> areaW<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> areaH<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> lights<span style="color: #000066; 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><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #009966; font-style: italic;">/* 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: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> areaHeight<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> numberOfLights<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> lightSize<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> lightColor<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">uint</span><span style="color: #000066; font-weight: bold;">,</span> minimumScale<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">,</span> hSpeed<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> vSpeed<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> dir<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">quality</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #009966; font-style: italic;">/* Set variables */</span>
			areaW = areaWidth<span style="color: #000066; font-weight: bold;">;</span>
			areaH = areaHeight<span style="color: #000066; font-weight: bold;">;</span>
			lightsNumber = numberOfLights<span style="color: #000066; font-weight: bold;">;</span>
			lightsDir = dir<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009966; font-style: italic;">/* 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: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> numberOfLights<span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #009966; font-style: italic;">/* Create the specified number of lights */</span>
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> light<span style="color: #000066; 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><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #009966; font-style: italic;">/* Set random speed to x and y based on the params*/</span>
&nbsp;
				xSpeed = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</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: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span>hSpeed <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000066; font-weight: bold;">-</span>hSpeed <span style="color: #000066; 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: #000066; font-weight: bold;">+</span> <span style="color: #000066; font-weight: bold;">-</span>hSpeed<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				ySpeed = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</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: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> vSpeed<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">0.5</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				light<span style="color: #000066; font-weight: bold;">.</span>xSpeed = xSpeed<span style="color: #000066; font-weight: bold;">;</span>
				light<span style="color: #000066; font-weight: bold;">.</span>ySpeed = ySpeed<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #009966; font-style: italic;">/* Create lights */</span>
&nbsp;
				light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>lightColor<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</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: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> lightSize <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #009966; font-style: italic;">/* Set a position based on the params specified */</span>
&nbsp;
				light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> areaWidth<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> areaHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</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: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> blur<span style="color: #000066; 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: #000066; font-weight: bold;">,</span><span style="color: #004993;">b</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">quality</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> filterArray<span style="color: #000066; 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><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">filters</span> = filterArray<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #009966; font-style: italic;">/* Change alpha */</span>
&nbsp;
				light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">alpha</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">0.6</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">0.1</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #009966; font-style: italic;">/* Scale */</span>
&nbsp;
				light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">scaleX</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</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: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000066; font-weight: bold;">-</span> minimumScale<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> minimumScale<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">;</span>
				light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">scaleY</span> = light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">scaleX</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #009966; font-style: italic;">/* Add the lights */</span>
&nbsp;
				<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>light<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #009966; font-style: italic;">/* Store lights in an array to use it later */</span>
&nbsp;
				lights<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>light<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #009966; font-style: italic;">/* Check for lights direction */</span>
&nbsp;
				checkDirection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009966; font-style: italic;">/* 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: #000066; 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: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> lights<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; 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: #000066; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> moveUp<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;down&quot;</span> <span style="color: #000066; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> moveDown<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;right&quot;</span> <span style="color: #000066; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> moveRight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;left&quot;</span> <span style="color: #000066; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> moveLeft<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #0033ff; font-weight: bold;">default</span> <span style="color: #000066; 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: #000066; font-weight: bold;">;</span>
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009966; font-style: italic;">/* 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: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span>= e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>xSpeed<span style="color: #000066; font-weight: bold;">;</span>
			e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>y<span style="color: #000066; font-weight: bold;">-</span>=e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>ySpeed<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009966; font-style: italic;">/* 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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; 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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = areaH <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span> e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> <span style="color: #009966; font-style: italic;">/ 2) &lt; 0 || (e.target.x - e.target.width /</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> areaW<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = areaH <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009966; font-style: italic;">/* 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: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">+</span>=e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>xSpeed<span style="color: #000066; font-weight: bold;">;</span>
			e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">+</span>=e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>ySpeed<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009966; font-style: italic;">/* 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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> areaH<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span> e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> <span style="color: #009966; font-style: italic;">/ 2) &lt; 0 || (e.target.x - e.target.width /</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> areaW<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = areaH <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009966; font-style: italic;">/* 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: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">+</span>=e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>ySpeed<span style="color: #000066; font-weight: bold;">;</span>
			e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">+</span>=e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>xSpeed<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009966; font-style: italic;">/* 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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #009966; font-style: italic;">/ 2) &gt; areaH || e.target.y + (e.target.height /</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; 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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span>areaH<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">-</span> e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> areaW<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009966; font-style: italic;">/* 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: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>x<span style="color: #000066; font-weight: bold;">-</span>=e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>ySpeed<span style="color: #000066; font-weight: bold;">;</span>
			e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>y<span style="color: #000066; font-weight: bold;">-</span>=e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>xSpeed<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #009966; font-style: italic;">/* 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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #009966; font-style: italic;">/ 2) &gt; areaH || e.target.y + (e.target.height /</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; 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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = areaW <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span>=<span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span>areaH<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span> e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; 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: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = areaW <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span>=<span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</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/introduction-flash-actionscript/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<span style="color: #000066; font-weight: bold;">.</span>Lights<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
  <span style="color: #6699cc; font-weight: bold;">var</span> light<span style="color: #000066; 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><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
  light<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">640</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">310</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">300</span><span style="color: #000066; font-weight: bold;">,</span> 0xFFFFFF<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0.5</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;up&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
  <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>light<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</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/introduction-flash-actionscript/feed</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>jQuery Lightbox / Modal Plugin</title><link>http://thinkclay.com/news/jquery-lightbox-modal-plugin</link> <comments>http://thinkclay.com/news/jquery-lightbox-modal-plugin#comments</comments> <pubDate>Sun, 02 Jan 2011 20:17:51 +0000</pubDate> <dc:creator>Clay McIlrath</dc:creator> <category><![CDATA[News]]></category> <category><![CDATA[developer tools]]></category> <category><![CDATA[front-end]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[JS]]></category> <category><![CDATA[Lightbox]]></category> <category><![CDATA[web 2.0]]></category> <guid
isPermaLink="false">http://thinkclay.com/?p=1175</guid> <description><![CDATA[There are SO MANY different types of <a
href="http://devsnippets.com/?cat=13">lightbox scripts in the wild</a>, and while most of them are absolutely fantastic (<a
href="http://www.shadowbox-js.com/" title="Shadowbox Lightbox">shadowbox</a> being one of my favorites) most of them are very limited in the control that they give you over the style, function and code. To make things worse, most of these <strong>lightbox scripts</strong> are also 5k or bigger, which is 5k more than you need sometimes. If you're like me, and you do a lot of customization or want to tweak your code to be as fast as possible, then you'll want this simple little <strong>jquery lightbox plugin</strong>. <strong>Style your lightbox</strong> exactly how you'd like and then simple invoke the modal() function and you'll be able to trigger the lightbox.]]></description> <content:encoded><![CDATA[<p>There are SO MANY different types of <a
href="http://devsnippets.com/?cat=13">lightbox scripts in the wild</a>, and while most of them are absolutely fantastic (<a
href="http://www.shadowbox-js.com/" title="Shadowbox Lightbox">shadowbox</a> being one of my favorites) most of them are very limited in the control that they give you over the style, function and code. To make things worse, most of these <strong>lightbox scripts</strong> are also 5k or bigger, which is 5k more than you need sometimes. If you&#8217;re like me, and you do a lot of customization or want to tweak your code to be as fast as possible, then you&#8217;ll want this simple little <strong>jquery lightbox plugin</strong>. <strong>Style your lightbox</strong> exactly how you&#8217;d like and then simple invoke the modal() function and you&#8217;ll be able to trigger the lightbox.</p><div
class="wp_syntax"><div
class="code"><pre class="javascript" style="font-family:monospace;">jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">modal</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;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><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: #003366; font-weight: bold;">var</span> ah <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> wh <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> nh <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>wh<span style="color: #339933;">/</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>ah<span style="color: #339933;">/</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> aw <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> ww <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> nw <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ww<span style="color: #339933;">/</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>aw<span style="color: #339933;">/</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// Trim body height, append overlay, and disable scrolling (this can be undone with a custom close button)</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;body&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>wh<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'overflow'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'hidden'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;div class=&quot;overlay&quot;&gt;&lt;<span style="color: #000099; font-weight: bold;">\/</span>div&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.overlay&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slow&quot;</span><span style="color: #339933;">,</span> .8<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'top'</span><span style="color: #339933;">:</span>nh<span style="color: #339933;">,</span> <span style="color: #3366CC;">'left'</span><span style="color: #339933;">:</span>nw<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slow&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>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div><p>This code is what i use for the overlay, you can customize as you&#8217;d like. The actual div is appended to the body with JavaScript.</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.overlay</span> <span style="color: #00AA00;">&#123;</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;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">110%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">1001</span><span style="color: #00AA00;">;</span>
	-moz-opacity<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0.8</span><span style="color: #00AA00;">;</span>
	opacity<span style="color: #00AA00;">:</span>.8<span style="color: #00AA00;">;</span>
	filter<span style="color: #00AA00;">:</span> alpha<span style="color: #00AA00;">&#40;</span>opacity<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">80</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div><p>This is an example of a <a
href="http://mycalorienumber.com/mynumber">modal/lightbox</a> i did using this plugin. Very simple CSS:</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.modal</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#00121b</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">min-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">54.5em</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">56.5em</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#111e24</span><span style="color: #00AA00;">;</span>
	box-shadow<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">1em</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
	-moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">1em</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
	-webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">1em</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1002</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div> ]]></content:encoded> <wfw:commentRss>http://thinkclay.com/news/jquery-lightbox-modal-plugin/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> <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. If you want to hire or request help with fbjs, fbml, or facebook development in general, you can do [...]]]></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. If you want to hire or request help with fbjs, fbml, or facebook development in general, you can do so by contacting my company <a
href="http://chosencollective.com">Chosen</a></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>34</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>17</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[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> </channel> </rss>
