<?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; flash</title>
	<atom:link href="http://thinkclay.com/tag/flash/feed" rel="self" type="application/rss+xml" />
	<link>http://thinkclay.com</link>
	<description>Creative Media Design, Powered by Wordpress</description>
	<lastBuildDate>Thu, 29 Jul 2010 18:35:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Pros and Cons of using sIFR</title>
		<link>http://thinkclay.com/technology/pros-cons-using-sifr</link>
		<comments>http://thinkclay.com/technology/pros-cons-using-sifr#comments</comments>
		<pubDate>Wed, 22 Jul 2009 07:56:58 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[developer tools]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[web browser]]></category>
		<category><![CDATA[web standards]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=1068</guid>
		<description><![CDATA[<a href="http://thinkclay.com/technology/pros-cons-using-sifr"><img class="alignleft" src="http://thinkclay.com/wp-content/uploads/2009/07/sifr.jpg" alt="sifr" title="sifr" width="300" height="200" /></a>sIFR (scalable Inman Flash Replacement): allows for dynamically-generated snippets of text to use any font supported in Flash using a combination of JavaScript and Flash embedding to replace characters on the page.
In <a href="http://thinkclay.com/technology/cufon-sifr-flir" title="sIFR vs Cufon vs FLIR">my last post regarding sIFR</a>, I compared <strong>sIFR</strong> against <strong>Cufon</strong> and <strong>FLIR</strong>. Since there is a great deal of interest in them, I decided to go deeper into what I believe is the superior out of the three.. ]]></description>
			<content:encoded><![CDATA[<p><a href="http://thinkclay.com/technology/pros-cons-using-sifr"><img class="alignleft" src="http://thinkclay.com/wp-content/uploads/2009/07/sifr.jpg" alt="sifr" title="sifr" width="300" height="200" /></a>sIFR (scalable Inman Flash Replacement): allows for dynamically-generated snippets of text to use any font supported in Flash using a combination of JavaScript and Flash embedding to replace characters on the page. </p>
<p>In <a href="http://thinkclay.com/technology/cufon-sifr-flir" title="sIFR vs Cufon vs FLIR">my last post regarding sIFR</a>, I compared <strong>sIFR</strong> against a few of the other popular font replacement methods such as <strong>Cufon</strong> and <strong>FLIR</strong>. Since there is obviously a great deal of interest in the subject of font replacement, I figured it would be beneficial to show a deeper analysis at sIFR which I believe is the superior out of the three.</p>
<h2>A deeper look at pros of sIFR</h2>
<p>sIFR is quite different to the many font replacement techniques in the wild. Instead of manually generating each header through an image generator such as <strong>FLIR</strong> and <strong>Cufon</strong> do, sIFR is able to load a flash object and replace each element on the fly. The scripted effect works for roughly 95% of world wide web users according to statistics for Flash support and JavaScript support in modern browsers. Note also, that sIFR is by no means required, and degrades gracefully if the user does not have one of these components required. I&#8217;m sure some purists would react with contempt, but this method causes no harm to usability and only effects load time if used incorrectly (such as replacing body text rather than headers).</p>
<h2>sIFR&#8230; what&#8217;s not to love?</h2>
<p>First and foremost, implementation can be slaughtered. For an inexperienced developer, sIFR can take up to an hour to implement (from what I&#8217;ve heard in complaints anyways) and can cause pages to load slowly. From my experience, both are due to an incompetent developer, as sIFR is quite easy to implement if you understand all front-end technologies (which you should be a front-end developer) and only causes slow load time if its used for large blocks of text. Compare sIFR to the first wave of Web 2.0 technologies.. to this day I see wannabe developers implementing 20k+ javascript libraries to do one simple &#8220;jiggle&#8221; or &#8220;ajax&#8221; ability, which you can do with a few lines of code if you understand raw JavaScript. We can&#8217;t blame the technology for human error.. sIFR is brilliant. It may have a ways to go before it&#8217;s perfect, but respecting the principles of semantics, usability, and accessibility.. <strong>sIFR</strong> by far is winning the race against <strong>Cufon</strong> and <strong>FLIR</strong>.</p>
<p>Now to address the purists and their complaint about flash and JS dependency. Plain and simply, if a user falls within the 3-10% that doesn’t have Flash or JavaScript enabled, then BIG DEAL. That&#8217;s what good old HTML/CSS are for.. a fall back solution. Should we punish those with modern browsers and technologies for the minority that will get a slightly-less-quality rendering? I don&#8217;t punish modern browsers by neglecting the wonders of CSS 3. If Internet Explorer sees a box with square corners instead of rounded.. BIG DEAL. So why should we fight about whether a user has JS or Flash enabled? Heck, you can even use image replacement at that point, if you really want to. </p>
<h2>The Big Picture</h2>
<p>The real issue is that there aren’t enough fonts supported in Internet Explorer. If we want to point fingers and find something to criticize, there it is. Firefox, Safari, Chrome, Opera.. they&#8217;re all supporting more CSS properties such as <strong>@font-face</strong>. However, due to copyright laws and support from Internet Explorer we are bound to 5-10 fonts that we can reasonably assume the user has installed, and that’s ALL we&#8217;ve got. Solutions have been offered and argued but the problems are still much broader.. ranging from font licensing, support and rendering, with no clear solution in sight.</p>
<p>sIFR is one solution of many offered by developers fighting a war for creative freedom. It&#8217;s here and now, it&#8217;s legal despite the font, and regardless of the few quirks.. it’s usable. If you use it, then I hope you implement it well. If you protest it, then I hope you have valid reasons, and aren&#8217;t just complaining because you&#8217;re ignorant. Take this post with a grain of salt.. it&#8217;s my 2 cents and nothing more.</p>
<h3>Read further:</h3>
<p><a href="http://thinkclay.com/technology/cufon-sifr-flir" title="sIFR vs Cufon vs FLIR">Cufon vs sIFR vs FLIR</a><br />
<a href="http://decasa.eu/content/fonts-seo-and-compatibility-designer%E2%80%99s-dilemma">Style vs SEO</a><br />
<a href="http://www.fontembedding.com/fonts-and-the-law/">Fonts and the Law</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/technology/pros-cons-using-sifr/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Basics: Part 1</title>
		<link>http://thinkclay.com/creativity/flash-basics-part-1</link>
		<comments>http://thinkclay.com/creativity/flash-basics-part-1#comments</comments>
		<pubDate>Wed, 27 May 2009 05:30:19 +0000</pubDate>
		<dc:creator>Clay McIlrath</dc:creator>
				<category><![CDATA[Creativity]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[digital art]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[front-end]]></category>
		<guid isPermaLink="false">http://thinkclay.com/?p=963</guid>
		<description><![CDATA[<div class="alignleft" style="padding-right: 2em;"><object height="145" width="300" type="application/x-shockwave-flash" data="http://thinkclay.com/wp-content/uploads/2009/05/bubbles.swf" id="swfceb51" style="visibility: visible;"><param name="wmode" value="window"/><param name="menu" value="false"/><param name="quality" value="high"/><param name="bgcolor" value="#FFFFFF"/></object>
<script type="text/javascript">
	swfobject.embedSWF("http://thinkclay.com/wp-content/uploads/2009/05/bubbles.swf", "swfceb51", "300", "145", "9.0.0", "", {}, {wmode: "window", menu: "false", quality: "high", bgcolor: "#FFFFFF"}, {});
</script></div>A tutorial and explanation of Adobe Flash basics, understanding palletes and layout of the program. This tutorial will also walk step-by-step through actionscript and how actionscript is integrated into a flash animation using symbols and objects.]]></description>
			<content:encoded><![CDATA[<p>
<object width="490" height="237">
<param name="movie" value="http://thinkclay.com/wp-content/uploads/2009/05/bubbles.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="490" height="237" src="http://thinkclay.com/wp-content/uploads/2009/05/bubbles.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
<p>For too long I&#8217;ve put off learning Flash because I never liked the layout of the program, but I decided today that like it or not, flash is a very popular front-end development tool. Being a front-end developer it&#8217;s important to know every tool and technology to some extent and understand the inner workings of each technology and how to integrate them with other markup and programming. So let&#8217;s dive into some screenshots and descriptions and learn Adobe Flash.</p>
<h2>Getting to know the program</h2>
<p><a href="http://thinkclay.com/creativity/flash-basics-part-1/attachment/screenshot-palletes" rel="attachment wp-att-971"><img src="http://thinkclay.com/wp-content/uploads/2009/05/screenshot-palletes-640x360.jpg" alt="Flash Layout" title="Screenshot with Descriptions of Flash Palletes" width="490" /></a></p>
<h2>Create a new Flash File (Actionscript 3.0)</h2>
<ul>
<li>Create a new Flash File by going to File > New > Flash File (Actionscript 3.0)</li>
<li>Change the document size and frame rate to your liking (Modify > Document), I used 640 x 310 and 18 fps</li>
<li>Use the Rectangle tool and draw a rectangle on Layer 1 with the color you&#8217;d like</li>
<li>Create any other layers or draw any other objects or place text. I created a text object on top of the rectangle</li>
<li>Name &#8220;Layer 1&#8243; to &#8220;Background&#8221; and create a new layer named &#8220;Code&#8221;</li>
<li>Save the Document</li>
</ul>
<h2>Create a new Actionscript File</h2>
<p><a href="http://thinkclay.com/creativity/flash-basics-part-1/attachment/new-actionscript-file" rel="attachment wp-att-974"><img src="http://thinkclay.com/wp-content/uploads/2009/05/new-actionscript-file-640x360.jpg" alt="Create a new Actionscript File" title="Create a new Actionscript File" width="490" /></a></p>
<h3>Paste in the code</h3>
<p><a href="http://thinkclay.com/creativity/flash-basics-part-1/attachment/paste-code" rel="attachment wp-att-975"><img src="http://thinkclay.com/wp-content/uploads/2009/05/paste-code-640x360.jpg" alt="Paste in the Code" title="Paste in the Actionscript Code" width="490" /></a></p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/* Blurry Lights Animation */</span>
&nbsp;
<span style="color: #9900cc; font-weight: bold;">package</span> Classes
<span style="color: #000000;">&#123;</span>
	<span style="color: #3f5fbf;">/* Import required classes */</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">MovieClip</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span>.<span style="color: #004993;">BitmapFilter</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span>.<span style="color: #004993;">BlurFilter</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Lights extends <span style="color: #004993;">MovieClip</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #3f5fbf;">/* Vars */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> lightsNumber<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> xSpeed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> ySpeed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> lightsDir<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> areaW<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> areaH<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> lights<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
		<span style="color: #3f5fbf;">/* Main function */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span>areaWidth<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, areaHeight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, numberOfLights<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, lightSize<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, lightColor<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>, minimumScale<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>, hSpeed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, vSpeed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, dir<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>, <span style="color: #004993;">quality</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #3f5fbf;">/* Set variables */</span>
			areaW = areaWidth;
			areaH = areaHeight;
			lightsNumber = numberOfLights;
			lightsDir = dir;
&nbsp;
			<span style="color: #3f5fbf;">/* Use a for to create the parameter-specified number of lights*/</span>
			<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> numberOfLights; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #3f5fbf;">/* Create the specified number of lights */</span>
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> light<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Set random speed to x and y based on the params*/</span>
&nbsp;
				xSpeed = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span>hSpeed <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000; font-weight: bold;">-</span>hSpeed <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight: bold;">-</span>hSpeed<span style="color: #000000;">&#41;</span>;
				ySpeed = <span style="color: #004993;">Math</span>.<span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> vSpeed<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">0.5</span><span style="color: #000000;">&#41;</span>;
&nbsp;
				light.xSpeed = xSpeed;
				light.ySpeed = ySpeed;
&nbsp;
				<span style="color: #3f5fbf;">/* Create lights */</span>
&nbsp;
				light.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>lightColor<span style="color: #000000;">&#41;</span>;
				light.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">drawCircle</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #000000; font-weight:bold;">0</span>, lightSize <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				light.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Set a position based on the params specified */</span>
&nbsp;
				light.<span style="color: #004993;">x</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> areaWidth<span style="color: #000000;">&#41;</span>;
				light.<span style="color: #004993;">y</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> areaHeight<span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Add blur, we declare the var here to get a new blur w/every light */</span>
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">b</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">5</span>;
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> blur<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapFilter</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">BlurFilter</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">b</span>,<span style="color: #004993;">b</span>,<span style="color: #004993;">quality</span><span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> filterArray<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span>blur<span style="color: #000000;">&#41;</span>;
&nbsp;
				light.<span style="color: #004993;">filters</span> = filterArray;
&nbsp;
				<span style="color: #3f5fbf;">/* Change alpha */</span>
&nbsp;
				light.<span style="color: #004993;">alpha</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">0.6</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">0.1</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Scale */</span>
&nbsp;
				light.<span style="color: #004993;">scaleX</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000000; font-weight: bold;">-</span> minimumScale<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> minimumScale<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">100</span>;
				light.<span style="color: #004993;">scaleY</span> = light.<span style="color: #004993;">scaleX</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Add the lights */</span>
&nbsp;
				<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>light<span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Store lights in an array to use it later */</span>
&nbsp;
				lights.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>light<span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #3f5fbf;">/* Check for lights direction */</span>
&nbsp;
				checkDirection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/* Check direction */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> checkDirection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> lights.<span style="color: #004993;">length</span>; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">switch</span> <span style="color: #000000;">&#40;</span> lightsDir <span style="color: #000000;">&#41;</span>
				<span style="color: #000000;">&#123;</span>
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;up&quot;</span> <span style="color: #000000; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, moveUp<span style="color: #000000;">&#41;</span>;
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span>;
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;down&quot;</span> <span style="color: #000000; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, moveDown<span style="color: #000000;">&#41;</span>;
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span>;
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;right&quot;</span> <span style="color: #000000; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, moveRight<span style="color: #000000;">&#41;</span>;
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span>;
					<span style="color: #0033ff; font-weight: bold;">case</span> <span style="color: #990000;">&quot;left&quot;</span> <span style="color: #000000; font-weight: bold;">:</span>
&nbsp;
						lights<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, moveLeft<span style="color: #000000;">&#41;</span>;
&nbsp;
						<span style="color: #0033ff; font-weight: bold;">break</span>;
					<span style="color: #0033ff; font-weight: bold;">default</span> <span style="color: #000000; font-weight: bold;">:</span>
&nbsp;
						<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Something weird just happened!&quot;</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/* Move Up function */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moveUp<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span>= e.<span style="color: #004993;">target</span>.xSpeed;
			e.<span style="color: #004993;">target</span>.y<span style="color: #000000; font-weight: bold;">-</span>=e.<span style="color: #004993;">target</span>.ySpeed;
&nbsp;
			<span style="color: #3f5fbf;">/* Reset light position, Y first, then X  */</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = areaH <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaW<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = areaH <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/* Move Down function */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moveDown<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">+</span>=e.<span style="color: #004993;">target</span>.xSpeed;
			e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">+</span>=e.<span style="color: #004993;">target</span>.ySpeed;
&nbsp;
			<span style="color: #3f5fbf;">/* Reset light position, Y first, then X */</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaH<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaW<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = areaH <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/* Move Right function */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moveRight<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">+</span>=e.<span style="color: #004993;">target</span>.ySpeed;
			e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">+</span>=e.<span style="color: #004993;">target</span>.xSpeed;
&nbsp;
			<span style="color: #3f5fbf;">/* Reset light position, Y first, then X */</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaH <span style="color: #000000; font-weight: bold;">||</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaH<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaW<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/* Move Left function */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moveLeft<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			e.<span style="color: #004993;">target</span>.x<span style="color: #000000; font-weight: bold;">-</span>=e.<span style="color: #004993;">target</span>.ySpeed;
			e.<span style="color: #004993;">target</span>.y<span style="color: #000000; font-weight: bold;">-</span>=e.<span style="color: #004993;">target</span>.xSpeed;
&nbsp;
			<span style="color: #3f5fbf;">/* Reset light position, Y first, then X */</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> areaH <span style="color: #000000; font-weight: bold;">||</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> = areaW <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaH<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span> e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">x</span> = areaW <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
				e.<span style="color: #004993;">target</span>.<span style="color: #004993;">y</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>areaW<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>
<ul>
<li>Note the line &#8220;package Classes&#8221; near the top. This is the name of the folder that will contain your class file. Make sure you have this folder in the same directory as your other flash file and that the name of the folder matches the name of the package.</li>
<li>Save the file inside your &#8220;Classes&#8221; directory</li>
</ul>
<h3>Add your Actions to your Flash File</h3>
<p>You&#8217;ve created the ActionScript file and <em>Lights</em> class, now all you need to do is call that class and pass the parameters to the script. Do this by going to Window > Actions and pasting in the code. Save and preview / publish and you&#8217;re done!</p>
<p><a href="http://thinkclay.com/creativity/flash-basics-part-1/attachment/flash-actions-properties" rel="attachment wp-att-976"><img src="http://thinkclay.com/wp-content/uploads/2009/05/flash-actions-properties-640x360.jpg" alt="Window &gt; Actions" title="Flash - Add your actions to your flash document" width="490" /></a></p>
<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> Classes.Lights;
&nbsp;
  <span style="color: #6699cc; font-weight: bold;">var</span> light<span style="color: #000000; font-weight: bold;">:</span>Lights = <span style="color: #0033ff; font-weight: bold;">new</span> Lights<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
  light.<span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">640</span>, <span style="color: #000000; font-weight:bold;">310</span>, <span style="color: #000000; font-weight:bold;">10</span>, <span style="color: #000000; font-weight:bold;">300</span>, 0xFFFFFF, <span style="color: #000000; font-weight:bold;">0.5</span>, <span style="color: #000000; font-weight:bold;">1</span>, <span style="color: #000000; font-weight:bold;">1</span>, <span style="color: #990000;">&quot;up&quot;</span>, <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
&nbsp;
  <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>light<span style="color: #000000;">&#41;</span>;</pre></div></div>
<h2>Want more?</h2>
<p><a href="http://flash.tutsplus.com/tutorials/effects/create-a-whimsical-animated-flash-background/">Read more of the programming side</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thinkclay.com/creativity/flash-basics-part-1/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
