<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4540916209089598519</id><updated>2011-11-15T17:39:23.059-08:00</updated><category term='troubleshooting'/><category term='flash'/><category term='miscellaneous'/><category term='challenge'/><category term='no flash'/><category term='plug'/><category term='tools'/><category term='sound'/><category term='favorites'/><category term='tutorial'/><category term='handy'/><category term='genesis'/><category term='functions'/><category term='first'/><category term='actionscript'/><category term='mjw'/><category term='avoider game'/><category term='beginning'/><category term='bees'/><category term='life'/><category term='Flash Develop'/><title type='text'>Bigfoot Studios</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-801534983494869217</id><published>2011-11-15T17:20:00.000-08:00</published><updated>2011-11-15T17:39:23.188-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Flash Develop'/><category scheme='http://www.blogger.com/atom/ns#' term='mjw'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Flash Develop</title><content type='html'>&lt;style type="text/css"&gt;.actionscript3 .de1, .actionscript3 .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}.actionscript3  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}.actionscript3 a:link {color: #000060;}.actionscript3 a:hover {background-color: #f0f000;}.actionscript3 .imp {font-weight: bold; color: red;}.actionscript3 li, .actionscript3 .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% 'Courier New', Courier, monospace; color: #003030;}.actionscript3 .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}.actionscript3 .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}.actionscript3 .kw1 {color: #0033ff; font-weight: bold;}.actionscript3 .kw2 {color: #6699cc; font-weight: bold;}.actionscript3 .kw3 {color: #339966; font-weight: bold;}.actionscript3 .kw4 {color: #9900cc; font-weight: bold;}.actionscript3 .kw5 {color: #004993;}.actionscript3 .kw6 {color: #004993;}.actionscript3 .kw7 {color: #004993;}.actionscript3 .kw8 {color: #004993;}.actionscript3 .co1 {color: #009900; font-style: italic;}.actionscript3 .co2 {color: #009966; font-style: italic;}.actionscript3 .coMULTI {color: #3f5fbf;}.actionscript3 .br0 {color: #000000;}.actionscript3 .sy0 {color: #000066; font-weight: bold;}.actionscript3 .st0 {color: #990000;}.actionscript3 .nu0 {color: #000000; font-weight:bold;}.actionscript3 .me0 {color: #000000;}.actionscript3 span.xtra { display:block; }&lt;/style&gt;&lt;br /&gt;I've just started using Flash Develop, not enough to give a decent review, but enough to say, 'Hey... I kinda' like this!' but it didn't start out so well... I figured, what better way to dive back into AS3 &lt;span style="font-style:italic;"&gt;and&lt;/span&gt; get used to Flash Develop, than by going through &lt;a href="http://gamedev.michaeljameswilliams.com/"&gt;Michael James William's AS3 Avoider Game Tutorial&lt;/a&gt;? So I started on section 1, everything was going great... FD booted right up, it asked me to create a package, and... oh crud, which one should I pick? AS3 Project? Flash IDE project? AS3 with Preloader? HaXe? ...what the heck is HaXe? I definitely don't want Haxe, I guess... right? No, no, course not...&lt;br /&gt;Would you believe Michael helped me again? I found this post over on &lt;a href="http://active.tutsplus.com/tutorials/beginners-guide-to-flashdevelop-intro-basix/"&gt;Active Tuts+&lt;/a&gt; which explained which one was for me.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;OK, Really getting started now&lt;/span&gt;&lt;br /&gt;Ok, so my project is open and I jump right into section 1 of the AS3 tutorial. I scan down because a lot of the prep doesn't seem to apply... then I make my first enemy (using the Flash IDE), export the SWC, and import it into FD (the whole reason I jumped into FD in the first place - but that's for another story)&lt;br /&gt;I'm just humming along now! I create a new class: Enemy.as and then I press Ctrl+Enter to test my 'game'!&lt;br /&gt;...wait, there's no enemy on the screen! Where the heck is the enemy I just created? I check, double-check, TRIPLE check my spelling. I copy and paste from the tutorial. &lt;div&gt;Will. Not. Appear. &lt;/div&gt;&lt;div&gt;I remove the AS file from my project and add that code to my main AS file and now my enemy is there. ...huh?&lt;br /&gt;Time to hit Google again... thankfully I found this post on &lt;a href="http://www.onegiantmedia.com/compiling-with-flash-develop-3-and-flexsdk-using-custom-classes-and-designs-in-the-flash-library"&gt;One Giant Medias&lt;/a&gt; website before I went completely bald from frustration. It notes:&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;/span&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-weight:bold;"&gt;Issue:  &lt;/span&gt;&lt;br /&gt;Using custom classes with the same names as linkage library movie clips in Flash IDE would trace output but not show up on stage&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;and then it goes on to explain how to get it working. &lt;/div&gt;&lt;div&gt;So, I went back to the Flash IDE, right-clicked my Enemy in the library and chose Linkage...&lt;/div&gt;&lt;div&gt;I changed the class to FL_Enemy, saved, and published the file.&lt;/div&gt;&lt;div&gt;Time to go back to Flash Develop, now open up that Enemy.as class file and change&lt;/div&gt;&lt;div&gt;public class Enemy extends MovieClip&lt;/div&gt;&lt;div&gt;to &lt;/div&gt;&lt;div&gt;public class Enemy extends FL_Enemy&lt;/div&gt;&lt;div&gt;...by the way, you don't have to pick &lt;b&gt;FL_&lt;/b&gt;Enemy for the library class, it can be anything, but appending FL_ is a suggestion from the OneGiantMedia blog article. Of course, you'd have known that if you clicked the link above!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;...back to programming!&lt;/div&gt;&lt;div&gt;-Bigfoot&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-801534983494869217?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/801534983494869217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2011/11/flash-develop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/801534983494869217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/801534983494869217'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2011/11/flash-develop.html' title='Flash Develop'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-5368494919718830310</id><published>2009-09-11T19:11:00.000-07:00</published><updated>2009-09-11T19:21:05.658-07:00</updated><title type='text'>Update!</title><content type='html'>&lt;style type="text/css"&gt;&lt;br /&gt;.actionscript3 .de1, .actionscript3 .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}&lt;br /&gt;.actionscript3  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}&lt;br /&gt;.actionscript3 a:link {color: #000060;}&lt;br /&gt;.actionscript3 a:hover {background-color: #f0f000;}&lt;br /&gt;.actionscript3 .imp {font-weight: bold; color: red;}&lt;br /&gt;.actionscript3 li, .actionscript3 .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% 'Courier New', Courier, monospace; color: #003030;}&lt;br /&gt;.actionscript3 .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}&lt;br /&gt;.actionscript3 .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}&lt;br /&gt;.actionscript3 .kw1 {color: #0033ff; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw2 {color: #6699cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw3 {color: #339966; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw4 {color: #9900cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw5 {color: #004993;}&lt;br /&gt;.actionscript3 .kw6 {color: #004993;}&lt;br /&gt;.actionscript3 .kw7 {color: #004993;}&lt;br /&gt;.actionscript3 .kw8 {color: #004993;}&lt;br /&gt;.actionscript3 .co1 {color: #009900; font-style: italic;}&lt;br /&gt;.actionscript3 .co2 {color: #009966; font-style: italic;}&lt;br /&gt;.actionscript3 .coMULTI {color: #3f5fbf;}&lt;br /&gt;.actionscript3 .br0 {color: #000000;}&lt;br /&gt;.actionscript3 .sy0 {color: #000066; font-weight: bold;}&lt;br /&gt;.actionscript3 .st0 {color: #990000;}&lt;br /&gt;.actionscript3 .nu0 {color: #000000; font-weight:bold;}&lt;br /&gt;.actionscript3 .me0 {color: #000000;}&lt;br /&gt;.actionscript3 span.xtra { display:block; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;It's been a while, thought it was time to post an update. Life's been exciting lately. I'm about to find out whether my wife is pregnant with a boy or a girl... I got laid off from my job... worked two new jobs (though only kept the second one...), and received two other offers (it's nice to feel wanted!)... and found out how to make a killer blended coffee drink! Ok, that last was the least exciting, but I'm going to fill you in on the details anyways...&lt;br /&gt;&lt;h2&gt;What you'll need...&lt;/h2&gt;&lt;br /&gt;&lt;li&gt;A blender (we have a 'Magic Bullet')&lt;/li&gt;&lt;br /&gt;&lt;li&gt;A pot of coffee (we used Wal-Mart brand)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Ice cube trays (these came with the apartment, believe it or not)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Sugar (sweeten to your taste, I like a little, my sweetie loves it sweeter!)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Milk (We've made it with both 1% and evaporated milk - both good!)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Some dark chocolate (optional)&lt;/li&gt;&lt;br /&gt;First, make a pot of coffee... After it's cooled down, pour the brewed coffee into ice cube trays and freeze overnight.&lt;br /&gt;The next morning, put some coffee cubes, sugar, milk, and chocolate into the blender and blend until smooth. ...That's it! Try it!&lt;br /&gt;&lt;p /&gt;&lt;br /&gt;Ok, on to other stuff... I've been working on &lt;a href="http://tbg.tonypa.pri.ee/start.html"&gt;Tonypa's tile based game flash tutorials&lt;/a&gt; aaaand the jury is still out on whether I like them or not. I'll finish them, and then maybe I'll feel more qualified to give my opinions... &lt;br /&gt;You'll just have to come back!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-5368494919718830310?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/5368494919718830310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/09/update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/5368494919718830310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/5368494919718830310'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/09/update.html' title='Update!'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-5945296047814954409</id><published>2009-08-11T22:34:00.000-07:00</published><updated>2009-08-13T10:52:23.898-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mjw'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><category scheme='http://www.blogger.com/atom/ns#' term='functions'/><title type='text'>Getting rid of duplicate lines of code</title><content type='html'>&lt;style type="text/css"&gt;&lt;br /&gt;.actionscript3 .de1, .actionscript3 .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}&lt;br /&gt;.actionscript3  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}&lt;br /&gt;.actionscript3 a:link {color: #000060;}&lt;br /&gt;.actionscript3 a:hover {background-color: #f0f000;}&lt;br /&gt;.actionscript3 .imp {font-weight: bold; color: red;}&lt;br /&gt;.actionscript3 li, .actionscript3 .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% 'Courier New', Courier, monospace; color: #003030;}&lt;br /&gt;.actionscript3 .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}&lt;br /&gt;.actionscript3 .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}&lt;br /&gt;.actionscript3 .kw1 {color: #0033ff; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw2 {color: #6699cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw3 {color: #339966; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw4 {color: #9900cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw5 {color: #004993;}&lt;br /&gt;.actionscript3 .kw6 {color: #004993;}&lt;br /&gt;.actionscript3 .kw7 {color: #004993;}&lt;br /&gt;.actionscript3 .kw8 {color: #004993;}&lt;br /&gt;.actionscript3 .co1 {color: #009900; font-style: italic;}&lt;br /&gt;.actionscript3 .co2 {color: #009966; font-style: italic;}&lt;br /&gt;.actionscript3 .coMULTI {color: #3f5fbf;}&lt;br /&gt;.actionscript3 .br0 {color: #000000;}&lt;br /&gt;.actionscript3 .sy0 {color: #000066; font-weight: bold;}&lt;br /&gt;.actionscript3 .st0 {color: #990000;}&lt;br /&gt;.actionscript3 .nu0 {color: #000000; font-weight:bold;}&lt;br /&gt;.actionscript3 .me0 {color: #000000;}&lt;br /&gt;.actionscript3 span.xtra { display:block; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;I just finished one of &lt;a href="http://gamedev.michaeljameswilliams.com/2009/05/20/avoider-game-shmup/comment-page-1/#comment-2428"&gt;MJW's sh'm'up tutorials&lt;/a&gt; and by the end I had multiple lines that were duplicates of each other. For example:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw7"&gt;removeChild&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; &lt;span class="kw7"&gt;bullet&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;bullets&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;splice&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; j&lt;span class="sy0"&gt;,&lt;/span&gt; 1 &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;While this used to be okay - I just wanted working code! - Now, after these tutorials I'm spoiled. Some would say a better (though very beginner!) programmer. I feel like I need to compact it and clean it up as much as possible. &lt;br /&gt;So I created a public function called removeClip (first it was removeEnemy, then I figured I could use it for the bullets too, and maybe other things later!) and passed it three variables: &lt;br /&gt;&lt;li&gt;instance of the clip I wanted to remove.&lt;br /&gt;&lt;li&gt;the position it was in the array&lt;br /&gt;&lt;li&gt;and, the array name.&lt;br /&gt;&lt;br /&gt;Tada!&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw3"&gt;function&lt;/span&gt; removeClip&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; movieClip&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"&gt;&lt;span class="kw5"&gt;MovieClip&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;,&lt;/span&gt; i&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"&gt;&lt;span class="kw5"&gt;int&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;,&lt;/span&gt; array&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"&gt;&lt;span class="kw5"&gt;Array&lt;/span&gt;&lt;/a&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;span class="kw1"&gt;void&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw7"&gt;removeChild&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; movieClip &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; array&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;splice&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; i&lt;span class="sy0"&gt;,&lt;/span&gt; 1 &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Then I just went back through AvoiderGame.as and replaced all those lines that removed the bullet / enemy with:&lt;br /&gt;removeClip( enemy, i, army );&lt;br /&gt;or &lt;br /&gt;removeClip( bullet, j, bullets );&lt;br /&gt;&lt;br /&gt;Michael, thanks for teaching us how to code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;EDIT&lt;/span&gt;: MJW posted a comment on trimming down my code even more that I'd like to share! (Especially in case you don't read the comments...)&lt;br /&gt;&lt;br /&gt;He wrote: "&lt;span style="font-style:italic;"&gt;I'm not sure if you know this, but all arrays have a method, .indexOf( item ), that returns the index of the item specified (or -1 if the item is not in the array).&lt;br /&gt;&lt;br /&gt;So you can write "array.splice( array.indexOf( movieClip ), 1 )", for example. This way you don't have to pass the index of the item through to the function each time!&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;I've used his suggestion, and changed my removeClip function to this:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw3"&gt;function&lt;/span&gt; removeClip&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; movieClip&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"&gt;&lt;span class="kw5"&gt;MovieClip&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;,&lt;/span&gt; array&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"&gt;&lt;span class="kw5"&gt;Array&lt;/span&gt;&lt;/a&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;span class="kw1"&gt;void&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw7"&gt;removeChild&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; movieClip &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; array&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;splice&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; array&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;indexOf&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; movieClip &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt; 1 &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;I guess if you wanted, you could also make a check to make sure it was part of that array before trying to splice, like this:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw3"&gt;function&lt;/span&gt; removeClip&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; movieClip&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=movieclip%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:movieclip.html"&gt;&lt;span class="kw5"&gt;MovieClip&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;,&lt;/span&gt; array&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html"&gt;&lt;span class="kw5"&gt;Array&lt;/span&gt;&lt;/a&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;span class="kw1"&gt;void&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw7"&gt;removeChild&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; movieClip &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; array&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;indexOf&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; movieClip &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="sy0"&gt;!&lt;/span&gt;= &lt;span class="sy0"&gt;-&lt;/span&gt;1 &amp;nbsp;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; array&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;splice&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; array&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;indexOf&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; movieClip &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt; 1 &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;Anyways, it might not seem like a lot at first. You're only slimming it down by one small variable. But that's one less variable for &lt;span style="font-style:italic;"&gt;every&lt;/span&gt; bullet that leaves the screen, or hits an enemy, plus every enemy that gets hit, or leaves the screen, and in a much bigger game it would really start adding up.&lt;br /&gt;&lt;br /&gt;A little more information about it &lt;a href="http://www.kirupa.com/forum/showpost.php?p=1959977&amp;postcount=232"&gt;here&lt;/a&gt; from Senocular&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-5945296047814954409?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/5945296047814954409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/08/getting-rid-of-duplicate-lines-of-code.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/5945296047814954409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/5945296047814954409'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/08/getting-rid-of-duplicate-lines-of-code.html' title='Getting rid of duplicate lines of code'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-445489583147699222</id><published>2009-08-06T12:43:00.000-07:00</published><updated>2009-08-07T12:05:40.787-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='mjw'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='avoider game'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>MJW Avoider Game ep11ch1</title><content type='html'>&lt;style type="text/css"&gt;&lt;br /&gt;.actionscript3 .de1, .actionscript3 .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}&lt;br /&gt;.actionscript3  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}&lt;br /&gt;.actionscript3 a:link {color: #000060;}&lt;br /&gt;.actionscript3 a:hover {background-color: #f0f000;}&lt;br /&gt;.actionscript3 .imp {font-weight: bold; color: red;}&lt;br /&gt;.actionscript3 li, .actionscript3 .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% 'Courier New', Courier, monospace; color: #003030;}&lt;br /&gt;.actionscript3 .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}&lt;br /&gt;.actionscript3 .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}&lt;br /&gt;.actionscript3 .kw1 {color: #0033ff; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw2 {color: #6699cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw3 {color: #339966; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw4 {color: #9900cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw5 {color: #004993;}&lt;br /&gt;.actionscript3 .kw6 {color: #004993;}&lt;br /&gt;.actionscript3 .kw7 {color: #004993;}&lt;br /&gt;.actionscript3 .kw8 {color: #004993;}&lt;br /&gt;.actionscript3 .co1 {color: #009900; font-style: italic;}&lt;br /&gt;.actionscript3 .co2 {color: #009966; font-style: italic;}&lt;br /&gt;.actionscript3 .coMULTI {color: #3f5fbf;}&lt;br /&gt;.actionscript3 .br0 {color: #000000;}&lt;br /&gt;.actionscript3 .sy0 {color: #000066; font-weight: bold;}&lt;br /&gt;.actionscript3 .st0 {color: #990000;}&lt;br /&gt;.actionscript3 .nu0 {color: #000000; font-weight:bold;}&lt;br /&gt;.actionscript3 .me0 {color: #000000;}&lt;br /&gt;.actionscript3 span.xtra { display:block; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;Alrighty-- Another challenge! I already wrote below about my fun with isNaN during this challenge. But let me try to document what I did for the challenge itself. Won't be too long...&lt;br /&gt;&lt;br /&gt;Staying in the GameOverScreen.as file, I added the following to the constructor. (I called my array bestScoreArray) I wanted to check if the array was undefined or empty, and if so, create it.&lt;br /&gt;&lt;div class="php" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; isNaN&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;data&lt;span class="sy0"&gt;.&lt;/span&gt;bestScoreArray&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;data&lt;span class="sy0"&gt;.&lt;/span&gt;bestScoreArray &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="kw2"&gt;new&lt;/span&gt; &lt;a href="http://www.php.net/array"&gt;&lt;span class="kw3"&gt;Array&lt;/span&gt;&lt;/a&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Then, I figured I'd plug information when the final score was set. So down in the setFinalScre function:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;else&lt;/span&gt; &lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; scoreValue &lt;span class="sy0"&gt;&amp;gt;&lt;/span&gt; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;bestScore &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="co1"&gt;//&amp;nbsp; sharedObject.data.bestScore = scoreValue;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;bestScoreArray = &lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;scoreValue&lt;span class="sy0"&gt;,&lt;/span&gt; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;totalGames&lt;span class="sy0"&gt;,&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;Test&amp;quot;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;I'm grabbing three pieces of information and sticking it in an array -- score, total number of games played when that score was reached, and an arbitrary string of text just to test. &lt;br /&gt;&lt;br /&gt;Ok, now I need to make sure it's working, so I threw this down below in the same 'setFinalScore' function. It will loop through the array and 'trace' every item to the output window.&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;for&lt;/span&gt; &lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="kw2"&gt;var&lt;/span&gt; i&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"&gt;&lt;span class="kw5"&gt;int&lt;/span&gt;&lt;/a&gt; = &lt;span class="nu0"&gt;0&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt; i &lt;span class="sy0"&gt;&amp;lt;&lt;/span&gt; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;bestScoreArray&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;length&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt; i&lt;span class="sy0"&gt;++&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw7"&gt;trace&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; i&lt;span class="sy0"&gt;,&lt;/span&gt; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;bestScoreArray&lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;i&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now run it.&lt;br /&gt;&lt;br /&gt;D'oh! Didn't work... why not? Looking back through my code I realized &lt;span style="font-style:italic;"&gt;this&lt;/span&gt; was wrong:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; &lt;span class="kw7"&gt;isNaN&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;bestScoreArray &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Can you spot why? Because we're creating an array... so it's NEVER going to be a "number" (isNaN checks if something is 'not a number')&lt;br /&gt;&lt;br /&gt;So, change that to this, and try again:&lt;br /&gt;&lt;div class="php" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;data&lt;span class="sy0"&gt;.&lt;/span&gt;bestScoreArray &lt;span class="sy0"&gt;==&lt;/span&gt; &lt;span class="kw4"&gt;null&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;data&lt;span class="sy0"&gt;.&lt;/span&gt;bestScoreArray &lt;span class="sy0"&gt;=&lt;/span&gt; &lt;span class="kw2"&gt;new&lt;/span&gt; &lt;a href="http://www.php.net/array"&gt;&lt;span class="kw3"&gt;Array&lt;/span&gt;&lt;/a&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Voila! Should work now. If you have any problems, let me know.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-445489583147699222?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/445489583147699222/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/08/mjw-avoider-game-ep11ch1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/445489583147699222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/445489583147699222'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/08/mjw-avoider-game-ep11ch1.html' title='MJW Avoider Game ep11ch1'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-1794346595425230532</id><published>2009-08-05T17:24:00.000-07:00</published><updated>2009-08-06T08:09:57.899-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='miscellaneous'/><category scheme='http://www.blogger.com/atom/ns#' term='life'/><category scheme='http://www.blogger.com/atom/ns#' term='no flash'/><title type='text'>Master! Master! Where's the dreams that I've been after...</title><content type='html'>I'm an Experts-Exchange fan. It's a great place to get quick help on technology problems. Well, how kewl is this? I got the rank of "Master" on there, and now they're sending me a free t-shirt. Not often that places actually do give away something free, they didn't even ask for s/h... :)&lt;br /&gt;&lt;br /&gt;&lt;table width="366" cellpadding="0" cellspacing="0" border="0"&gt;&lt;tr&gt;&lt;td valign="bottom"&gt;&lt;a href="http://www.experts-exchange.com/M_3542301.html"&gt;&lt;img src="http://www.experts-exchange.com/images/signatures/masterRankTop.gif" border="0"&gt;&lt;/a&gt;&lt;/td&gt;&lt;td colspan="2" valign="bottom" background="http://www.experts-exchange.com/images/signatures/masterTitleTop.gif"&gt;&lt;a href="http://www.experts-exchange.com/M_3542301.html" style="font: bold 16px Arial; color: #666; text-decoration:none;"&gt;Bigfoot&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;a href="http://www.experts-exchange.com/M_3542301.html"&gt;&lt;img src="http://www.experts-exchange.com/images/signatures/masterRankMiddle.gif" border="0"&gt;&lt;/a&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;a href="http://www.experts-exchange.com/M_3542301.html"&gt;&lt;img src="http://www.experts-exchange.com/images/signatures/masterTitleMiddle.gif" alt="Master" border="0"&gt;&lt;/a&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;a href="http://www.experts-exchange.com/M_3542301.html"&gt;&lt;img src="http://www.experts-exchange.com/images/signatures/masterPointsMiddle.gif" alt="50,000 Expert Points" border="0"&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;a href="http://www.experts-exchange.com/M_3542301.html"&gt;&lt;img src="http://www.experts-exchange.com/images/signatures/masterRankBottom.gif" border="0"&gt;&lt;/a&gt;&lt;/td&gt;&lt;td colspan="2"  valign="top"&gt;&lt;a href="http://www.experts-exchange.com/M_3542301.html"&gt;&lt;img src="http://www.experts-exchange.com/images/signatures//t2i/l_231.gif" alt="Windows XP Operating System" border="0"&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Wow, and Blogger.com &lt;span style="font-weight:bold;"&gt;totally&lt;/span&gt; screwed up the formatting on that signature...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-1794346595425230532?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/1794346595425230532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/08/master-master-wheres-dreams-that-ive.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/1794346595425230532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/1794346595425230532'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/08/master-master-wheres-dreams-that-ive.html' title='Master! Master! Where&apos;s the dreams that I&apos;ve been after...'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-806099249919436979</id><published>2009-08-05T16:37:00.000-07:00</published><updated>2009-08-06T08:09:14.592-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><category scheme='http://www.blogger.com/atom/ns#' term='handy'/><title type='text'>What is isNaN()?</title><content type='html'>&lt;style type="text/css"&gt;&lt;br /&gt;.actionscript3 .de1, .actionscript3 .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}&lt;br /&gt;.actionscript3  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}&lt;br /&gt;.actionscript3 a:link {color: #000060;}&lt;br /&gt;.actionscript3 a:hover {background-color: #f0f000;}&lt;br /&gt;.actionscript3 .imp {font-weight: bold; color: red;}&lt;br /&gt;.actionscript3 li, .actionscript3 .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% 'Courier New', Courier, monospace; color: #003030;}&lt;br /&gt;.actionscript3 .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}&lt;br /&gt;.actionscript3 .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}&lt;br /&gt;.actionscript3 .kw1 {color: #0033ff; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw2 {color: #6699cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw3 {color: #339966; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw4 {color: #9900cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw5 {color: #004993;}&lt;br /&gt;.actionscript3 .kw6 {color: #004993;}&lt;br /&gt;.actionscript3 .kw7 {color: #004993;}&lt;br /&gt;.actionscript3 .kw8 {color: #004993;}&lt;br /&gt;.actionscript3 .co1 {color: #009900; font-style: italic;}&lt;br /&gt;.actionscript3 .co2 {color: #009966; font-style: italic;}&lt;br /&gt;.actionscript3 .coMULTI {color: #3f5fbf;}&lt;br /&gt;.actionscript3 .br0 {color: #000000;}&lt;br /&gt;.actionscript3 .sy0 {color: #000066; font-weight: bold;}&lt;br /&gt;.actionscript3 .st0 {color: #990000;}&lt;br /&gt;.actionscript3 .nu0 {color: #000000; font-weight:bold;}&lt;br /&gt;.actionscript3 .me0 {color: #000000;}&lt;br /&gt;.actionscript3 span.xtra { display:block; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;So earlier I worked through &lt;a href="http://gamedev.michaeljameswilliams.com/2009/03/18/avoider-game-tutorial-11/"&gt;MJWs Avoider Game Tutorial Chapter 11&lt;/a&gt; and got to the challenges. I was excited! I wanted to save some data to the local computer too! So my first addition was going to be adding how many times the player played my game. Sounds easy enough, it was using the same idea as saving the highest score, right?&lt;br /&gt;&lt;br /&gt;Well, I figured GameOverScreen.as was as good a place as any -if not better!- to do this. So I added the following lines:&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;totalGames &lt;span class="sy0"&gt;+&lt;/span&gt;= &lt;span class="nu0"&gt;1&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw7"&gt;trace&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;totalGames &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&amp;nbsp; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;But my output didn't read "1" - it said NaN. Whaaaat?&lt;br /&gt;So I threw in an IF statement:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;totalGames == &lt;span class="kw1"&gt;null&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;totalGames = &lt;span class="nu0"&gt;0&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;Haha! MJW helped me to learn to code! &lt;br /&gt;...only problem was: It didn't work. My output still read NaN.&lt;br /&gt;Not one to just ask a question and wait for the answer (sorry, I told you to post a comment on MJW's site if you had a question... I'm a hypocrite) I browsed to Google and searched for an answer. &lt;br /&gt;&lt;br /&gt;The answer to my problem was isNaN! Here's what I put in my code:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; &lt;span class="kw7"&gt;isNaN&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;totalGames&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;totalGames = &lt;span class="nu0"&gt;0&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;totalGames &lt;span class="sy0"&gt;+&lt;/span&gt;= &lt;span class="nu0"&gt;1&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw7"&gt;trace&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; sharedObject&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;data&lt;/span&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;totalGames &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now &lt;span style="font-style:italic;"&gt;that&lt;/span&gt; works! I didn't even have to 'import' anything... though I did search for that because I accidentally put isNan (note the lower case 'n') in my code and got an error.&lt;br /&gt;&lt;br /&gt;So there you go... isNaN()&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-806099249919436979?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/806099249919436979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/08/what-is-isnan.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/806099249919436979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/806099249919436979'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/08/what-is-isnan.html' title='What is isNaN()?'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-4323310656519239534</id><published>2009-08-03T18:26:00.000-07:00</published><updated>2009-08-06T08:10:25.369-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mjw'/><category scheme='http://www.blogger.com/atom/ns#' term='avoider game'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>Michael asked for it...</title><content type='html'>&lt;style type="text/css"&gt;&lt;br /&gt;.actionscript3 .de1, .actionscript3 .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}&lt;br /&gt;.actionscript3  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}&lt;br /&gt;.actionscript3 a:link {color: #000060;}&lt;br /&gt;.actionscript3 a:hover {background-color: #f0f000;}&lt;br /&gt;.actionscript3 .imp {font-weight: bold; color: red;}&lt;br /&gt;.actionscript3 li, .actionscript3 .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% 'Courier New', Courier, monospace; color: #003030;}&lt;br /&gt;.actionscript3 .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}&lt;br /&gt;.actionscript3 .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}&lt;br /&gt;.actionscript3 .kw1 {color: #0033ff; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw2 {color: #6699cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw3 {color: #339966; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw4 {color: #9900cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw5 {color: #004993;}&lt;br /&gt;.actionscript3 .kw6 {color: #004993;}&lt;br /&gt;.actionscript3 .kw7 {color: #004993;}&lt;br /&gt;.actionscript3 .kw8 {color: #004993;}&lt;br /&gt;.actionscript3 .co1 {color: #009900; font-style: italic;}&lt;br /&gt;.actionscript3 .co2 {color: #009966; font-style: italic;}&lt;br /&gt;.actionscript3 .coMULTI {color: #3f5fbf;}&lt;br /&gt;.actionscript3 .br0 {color: #000000;}&lt;br /&gt;.actionscript3 .sy0 {color: #000066; font-weight: bold;}&lt;br /&gt;.actionscript3 .st0 {color: #990000;}&lt;br /&gt;.actionscript3 .nu0 {color: #000000; font-weight:bold;}&lt;br /&gt;.actionscript3 .me0 {color: #000000;}&lt;br /&gt;.actionscript3 span.xtra { display:block; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://gamedev.michaeljameswilliams.com/"&gt;MJW&lt;/a&gt; left a comment asking if I was going to post my game anytime soon. So by, umm... popular demand (Hey, 50% of my blogs' commenters asked for it!!) - here it is!&lt;br /&gt;&lt;br /&gt;The game gets difficult &lt;span style="font-weight:bold;"&gt;REALLY&lt;/span&gt; quick. But I don't really expect you to play it long. I'm just trying to get the basics down right now.&lt;br /&gt;&lt;br /&gt;&lt;embed src="http://spamness.elementfx.com/flash/Avoider.swf" width="400" height="300" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bigfoot-avoidergame.googlecode.com/files/Avoider.swf"&gt;http://bigfoot-avoidergame.googlecode.com/files/Avoider.swf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Comments, banter, criticism? Close your browser...&lt;br /&gt;Want to lavish praise? Leave it in the comment section!&lt;br /&gt;Kidding... I want to hear it all - leave me a comment if you play. We'll call it "Comment-Ware"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-4323310656519239534?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/4323310656519239534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/08/michael-asked-for-it.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/4323310656519239534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/4323310656519239534'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/08/michael-asked-for-it.html' title='Michael asked for it...'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-1476575288331426592</id><published>2009-07-29T17:11:00.000-07:00</published><updated>2009-07-30T07:13:01.516-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='sound'/><category scheme='http://www.blogger.com/atom/ns#' term='mjw'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='avoider game'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>MJW Avoider Game ep8ch1</title><content type='html'>&lt;style type="text/css"&gt;&lt;br /&gt;.actionscript3 .de1, .actionscript3 .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}&lt;br /&gt;.actionscript3  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}&lt;br /&gt;.actionscript3 a:link {color: #000060;}&lt;br /&gt;.actionscript3 a:hover {background-color: #f0f000;}&lt;br /&gt;.actionscript3 .imp {font-weight: bold; color: red;}&lt;br /&gt;.actionscript3 li, .actionscript3 .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% 'Courier New', Courier, monospace; color: #003030;}&lt;br /&gt;.actionscript3 .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}&lt;br /&gt;.actionscript3 .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}&lt;br /&gt;.actionscript3 .kw1 {color: #0033ff; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw2 {color: #6699cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw3 {color: #339966; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw4 {color: #9900cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw5 {color: #004993;}&lt;br /&gt;.actionscript3 .kw6 {color: #004993;}&lt;br /&gt;.actionscript3 .kw7 {color: #004993;}&lt;br /&gt;.actionscript3 .kw8 {color: #004993;}&lt;br /&gt;.actionscript3 .co1 {color: #009900; font-style: italic;}&lt;br /&gt;.actionscript3 .co2 {color: #009966; font-style: italic;}&lt;br /&gt;.actionscript3 .coMULTI {color: #3f5fbf;}&lt;br /&gt;.actionscript3 .br0 {color: #000000;}&lt;br /&gt;.actionscript3 .sy0 {color: #000066; font-weight: bold;}&lt;br /&gt;.actionscript3 .st0 {color: #990000;}&lt;br /&gt;.actionscript3 .nu0 {color: #000000; font-weight:bold;}&lt;br /&gt;.actionscript3 .me0 {color: #000000;}&lt;br /&gt;.actionscript3 span.xtra { display:block; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;...That'd be &lt;span style="font-style:italic;"&gt;ep&lt;/span&gt;isode &lt;span style="font-style:italic;"&gt;8&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;ch&lt;/span&gt;allenge &lt;span style="font-style:italic;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So now that he's shown us the magic of adding sound, he wants us to figure out how to create a Mute button on our own... sheesh. :) This was the easiest challenge, so far. But, so that I can solidify this in my own head, and in case you need help, here goes my thought process:&lt;br /&gt;&lt;br /&gt;The first step I wanted to complete, had nothing (directly) to do with sound. I wanted Flash to recognize another button was being pressed. Instead of being original, I picked "m" as my mute button... Feel free to pick L, meaning "Let the music stop", or ß (ALT+0223) for "This music was picked for the beta. If you don't like it you can turn it off."&lt;br /&gt;&lt;br /&gt;Going back and referencing my old code, I made these additions:&lt;br /&gt;&lt;br /&gt;All of them are in the &lt;span style="font-style:italic;"&gt;AvoiderGame.as&lt;/span&gt; file.&lt;br /&gt;&lt;br /&gt;Create a publicly accessible variable (outside contructor)...&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw2"&gt;var&lt;/span&gt; mKeyIsBeingPressed&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"&gt;&lt;span class="kw5"&gt;Boolean&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Initialize it in the contructor...&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;mKeyIsBeingPressed = &lt;span class="kw1"&gt;false&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Inside the onKeyPress function&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; keyboardEvent&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;keyCode&lt;/span&gt; == 77 &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; mKeyIsBeingPressed = &lt;span class="kw1"&gt;true&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Michael let you figure out the onKeyRelease function, and a student is not above his teacher, so I'll let you figure that out too.... :P&lt;br /&gt;&lt;br /&gt;Then in the onTick function, I used a trace() command as a placeholder&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; mKeyIsBeingPressed &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw7"&gt;trace&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;You're pressing M!!!&amp;quot;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Don't forget to "Disable Keyboard Shortcuts"&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh4.ggpht.com/_EHHKCICJFDc/SnDBK4-0EqI/AAAAAAAAAB0/_NYkN_ShSmk/FLASH_DisableKBShortcuts.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 410px; height: 355px;" src="http://lh4.ggpht.com/_EHHKCICJFDc/SnDBK4-0EqI/AAAAAAAAAB0/_NYkN_ShSmk/FLASH_DisableKBShortcuts.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;...and then watch your Output window. When you press m, it should fill up with "You're pressing M!!!" over and over...&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_EHHKCICJFDc/SnDGGUsPMNI/AAAAAAAAADM/zf5i-T95t18/s1600-h/FLASH_MuteOutput1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 120px;" src="http://3.bp.blogspot.com/_EHHKCICJFDc/SnDGGUsPMNI/AAAAAAAAADM/zf5i-T95t18/s320/FLASH_MuteOutput1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5364004968134029522" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Ok, so it's working, I have a stream of useless output to prove it. Now I want it to &lt;span style="font-style:italic;"&gt;actually do something useful!&lt;/span&gt; I created some new global variables:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw2"&gt;var&lt;/span&gt; musicPosition&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"&gt;&lt;span class="kw5"&gt;int&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw2"&gt;var&lt;/span&gt; musicIsMuted&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"&gt;&lt;span class="kw5"&gt;Boolean&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;musicPosition is an integer. It's going to be equal to where the music was muted, so that when it's unmuted it'll play from the same spot. I guess that makes it a pause button... so, sue me.&lt;br /&gt;musicIsMuted is straight forward. It's a true/false value of whether the music is muted.&lt;br /&gt;&lt;br /&gt;...and then I initialized them, one in the constructor (musicIsMuted), and one in the onTick function&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;musicIsMuted = &lt;span class="kw1"&gt;false&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;and&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; mKeyIsBeingPressed &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; musicIsMuted &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; musicPosition = &lt;a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"&gt;&lt;span class="kw5"&gt;Math&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;floor&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;bgmSoundChannel&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;position&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Ok, ok.... I did a little more then initialize it. I put together the basic if...else structure I was going to use. &lt;span style="font-style:italic;"&gt;If&lt;/span&gt; the m key is being pressed, &lt;span style="font-style:italic;"&gt;then if&lt;/span&gt; the music is already muted, do nothing right now, &lt;span style="font-style:italic;"&gt;else&lt;/span&gt; check the position (in milliseconds) it was muted at, and put that into our variable, as a whole number (that's what Math.floor() does, if you don't remember)&lt;br /&gt;&lt;br /&gt;Now, let's flesh it out some. If the music wasn't muted already, what do we want to do? We want to stop the background music from playing, and we want to change our variable (musicIsMuted) which tells us if the music is playing to true.&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; musicPosition = &lt;a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"&gt;&lt;span class="kw5"&gt;Math&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;floor&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;bgmSoundChannel&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;position&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; bgmSoundChannel&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;stop&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; musicIsMuted = &lt;span class="kw1"&gt;true&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;If the player already muted the music, and now wants it to play again (cause they miss those jazzy synth beats!) then we would want it to play from where it stopped (we can do that by passing the play() function an argument), and change the musicIsMuted variable back to false.&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; musicIsMuted &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; bgmSoundChannel = backgroundMusic&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;play&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; musicPosition &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; musicIsMuted = &lt;span class="kw1"&gt;false&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now save everything and test your game... Easy, huh?&lt;br /&gt;Oh, wait, you say it keeps rapidly turning off and on? Crud! Well, we can fix that using some tidbits from Michael's sh'm'up tutorial. &lt;br /&gt;&lt;br /&gt;Create another global variable:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw2"&gt;var&lt;/span&gt; ticksSinceMutePressed&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"&gt;&lt;span class="kw5"&gt;int&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Initialize it in the constructor:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;ticksSinceMutePressed = &lt;span class="nu0"&gt;0&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;and change your function to:&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; mKeyIsBeingPressed &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; ticksSinceMutePressed &lt;span class="sy0"&gt;&amp;gt;&lt;/span&gt; 10 &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; musicIsMuted &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bgmSoundChannel = backgroundMusic&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;play&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; musicPosition &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; musicIsMuted = &lt;span class="kw1"&gt;false&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="kw1"&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; musicPosition = &lt;a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"&gt;&lt;span class="kw5"&gt;Math&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;floor&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;bgmSoundChannel&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;position&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bgmSoundChannel&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;stop&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; musicIsMuted = &lt;span class="kw1"&gt;true&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; ticksSinceMutePressed = &lt;span class="nu0"&gt;0&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;ticksSinceMutePressed &lt;span class="sy0"&gt;+&lt;/span&gt;= &lt;span class="nu0"&gt;1&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;If you haven't read that tutorial already, and can't piece together what I did, head over and check it out. No use in me re-inventing the wheel.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://gamedev.michaeljameswilliams.com/2009/05/20/avoider-game-shmup/"&gt;Avoider Game Shmup&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That should do it. Now you can hear the 'thump, thump, thump' of the enemys coming on screen without that pesky synth-music playing in the background!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-1476575288331426592?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/1476575288331426592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/07/mjw-avoider-game-ep8ch1.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/1476575288331426592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/1476575288331426592'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/07/mjw-avoider-game-ep8ch1.html' title='MJW Avoider Game ep8ch1'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_EHHKCICJFDc/SnDBK4-0EqI/AAAAAAAAAB0/_NYkN_ShSmk/s72-c/FLASH_DisableKBShortcuts.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-320241916957319216</id><published>2009-07-27T12:29:00.001-07:00</published><updated>2009-07-27T12:42:15.442-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>Disappearing Flash Window?</title><content type='html'>I've had a bizarre problem happen with Flash CS3 &lt;span style="font-weight:bold;"&gt;twice&lt;/span&gt; now since I've been using it. I don't know what causes this but Flash &lt;span style="font-style:italic;"&gt;disappears&lt;/span&gt; when I "restore" the window (when it's not maximized) It's really bizarre. I mean, I can work with it maximized just fine, but I don't want it to HAVE to be maximized.&lt;br /&gt;I tried:&lt;br /&gt;Right-clicking it's button in the taskbar and selecting "Move", and then using the arrow keys and/or the mouse. &lt;span style="font-style:italic;"&gt;Didn't do anything.&lt;/span&gt;&lt;br /&gt;Right-clicking it's button in the taskbar and selecting "Size"... &lt;span style="font-style:italic;"&gt;Didn't do anything.&lt;/span&gt;&lt;br /&gt;I think I tried reinstalling Flash the first time. (I'm in IT - it was like a personal challenge!) - &lt;span style="font-style:italic;"&gt;Didn't do anything.&lt;/span&gt;&lt;br /&gt;Reset settings in Flash. Doing this caused my preferences to reset, unfortunately it didn't fix my problem. - &lt;span style="font-style:italic;"&gt;Didn't do anything useful.&lt;/span&gt;&lt;br /&gt;This time I searched online and found the solution on &lt;a href="http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/Q_23354586.html"&gt;Experts-Exchange&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;"I found this config file and renamed it:&lt;br /&gt;C:\Documents and Settings\%username%\Local Settings\Application Data\Macromedia\Flash 8\en\Configuration\panelset.xml&lt;br /&gt;&lt;br /&gt;Flash started again and all windows are visible again.  The above file was recreated..."&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So I tried the same thing, since I'm using CS3 they changed the name of the file on us, it's now called "workspacelayout.xml" - when I renamed it (to .old) and restarted Flash, I was able to restore my window and it actually showed up! &lt;br /&gt;"Happy! Happy! Joy! Joy! Happy! Happy! Joy! Joy! Happy....."&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-320241916957319216?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/320241916957319216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/07/disappearing-flash-window.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/320241916957319216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/320241916957319216'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/07/disappearing-flash-window.html' title='Disappearing Flash Window?'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-6683380707029556532</id><published>2009-07-24T17:20:00.000-07:00</published><updated>2009-07-27T07:58:02.424-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bees'/><category scheme='http://www.blogger.com/atom/ns#' term='miscellaneous'/><title type='text'>Bee Stings</title><content type='html'>Wow, I forgot how much bee stings can hurt! I haven't been stung in years, but was driving back from the gym earlier with my window open (I don't have A/C) A bee flew in, landed on me, stung me, and flew back out the window!&lt;br /&gt;Stupid bee...&lt;br /&gt;Yowch!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-6683380707029556532?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/6683380707029556532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/07/bee-stings.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/6683380707029556532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/6683380707029556532'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/07/bee-stings.html' title='Bee Stings'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-5498167916438111126</id><published>2009-07-23T15:59:00.000-07:00</published><updated>2009-07-29T07:28:52.380-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><category scheme='http://www.blogger.com/atom/ns#' term='favorites'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>Trace()</title><content type='html'>&lt;style type="text/css"&gt;&lt;!--&lt;br /&gt;/**&lt;br /&gt; * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann&lt;br /&gt; * (http://qbnz.com/highlighter/ and http://geshi.org/)&lt;br /&gt; */&lt;br /&gt;.actionscript3 .de1, .actionscript3 .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}&lt;br /&gt;.actionscript3  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}&lt;br /&gt;.actionscript3 a:link {color: #000060;}&lt;br /&gt;.actionscript3 a:hover {background-color: #f0f000;}&lt;br /&gt;.actionscript3 .imp {font-weight: bold; color: red;}&lt;br /&gt;.actionscript3 li, .actionscript3 .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% 'Courier New', Courier, monospace; color: #003030;}&lt;br /&gt;.actionscript3 .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}&lt;br /&gt;.actionscript3 .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}&lt;br /&gt;.actionscript3 .kw1 {color: #0033ff; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw2 {color: #6699cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw3 {color: #339966; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw4 {color: #9900cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw5 {color: #004993;}&lt;br /&gt;.actionscript3 .kw6 {color: #004993;}&lt;br /&gt;.actionscript3 .kw7 {color: #004993;}&lt;br /&gt;.actionscript3 .kw8 {color: #004993;}&lt;br /&gt;.actionscript3 .co1 {color: #009900; font-style: italic;}&lt;br /&gt;.actionscript3 .co2 {color: #009966; font-style: italic;}&lt;br /&gt;.actionscript3 .coMULTI {color: #3f5fbf;}&lt;br /&gt;.actionscript3 .br0 {color: #000000;}&lt;br /&gt;.actionscript3 .sy0 {color: #000066; font-weight: bold;}&lt;br /&gt;.actionscript3 .st0 {color: #990000;}&lt;br /&gt;.actionscript3 .nu0 {color: #000000; font-weight:bold;}&lt;br /&gt;.actionscript3 .me0 {color: #000000;}&lt;br /&gt;.actionscript3 span.xtra { display:block; }&lt;br /&gt;&lt;br /&gt;--!&gt;&lt;/style&gt;&lt;br /&gt;I &lt;span style="font-weight:bold;"&gt;cannot&lt;/span&gt; over. emphasize. my. love. of. the. Trace. Command (ok, maybe I can overemphasize it) &lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Seriously though&lt;/span&gt;, when it comes to debugging my AS3 code, &lt;span style="font-family:monospace;color: #006;"&gt;trace()&lt;/span&gt; is invaluable!&lt;br /&gt;&lt;br /&gt;For example, when trying to create different start buttons for mouse and keyboard controls I was trying to send navigation events, and changing variables, creating variables... sometimes, at first I wasn't sure if the code I implemented worked so I used trace to spit out some information into the 'output' tab. (It's down between 'Properties' and 'Compiler Errors') &lt;br /&gt;&lt;br /&gt;Here's how you use it:&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw7"&gt;trace&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; variableName &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt; &lt;span class="co1"&gt;// Outputs the value of that variable&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw7"&gt;trace&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;Your Text Here&amp;quot;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt; &lt;span class="co1"&gt;// Outputs 'Your Text Here'&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw7"&gt;trace&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; &lt;span class="st0"&gt;&amp;quot;AvoiderGame.as Line 37 xSpeed = &amp;quot;&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt; xSpeed &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt; &lt;span class="co1"&gt;//Outputs 'AvoiderGame.as Line 37 xSpeed = 6' (or whatever the value of xSpeed is...)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Easy Peasy Lemon Squeezy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-5498167916438111126?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/5498167916438111126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/07/trace.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/5498167916438111126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/5498167916438111126'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/07/trace.html' title='Trace()'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-7051579678353414136</id><published>2009-07-23T12:01:00.000-07:00</published><updated>2009-07-23T15:23:55.630-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plug'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><title type='text'>Reclaiming my zeal!</title><content type='html'>&lt;style type="text/css"&gt;&lt;!--&lt;br /&gt;/**&lt;br /&gt; * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann&lt;br /&gt; * (http://qbnz.com/highlighter/ and http://geshi.org/)&lt;br /&gt; */&lt;br /&gt;.actionscript3 .de1, .actionscript3 .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;color: #000020;}&lt;br /&gt;.actionscript3  {font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;}&lt;br /&gt;.actionscript3 a:link {color: #000060;}&lt;br /&gt;.actionscript3 a:hover {background-color: #f0f000;}&lt;br /&gt;.actionscript3 .imp {font-weight: bold; color: red;}&lt;br /&gt;.actionscript3 li, .actionscript3 .li1 {font-weight: normal; vertical-align:top;font: normal normal 130% 'Courier New', Courier, monospace; color: #003030;}&lt;br /&gt;.actionscript3 .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}&lt;br /&gt;.actionscript3 .li2 {font-weight: bold; vertical-align:top;font-weight: bold; color: #006060;}&lt;br /&gt;.actionscript3 .kw1 {color: #0033ff; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw2 {color: #6699cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw3 {color: #339966; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw4 {color: #9900cc; font-weight: bold;}&lt;br /&gt;.actionscript3 .kw5 {color: #004993;}&lt;br /&gt;.actionscript3 .kw6 {color: #004993;}&lt;br /&gt;.actionscript3 .kw7 {color: #004993;}&lt;br /&gt;.actionscript3 .kw8 {color: #004993;}&lt;br /&gt;.actionscript3 .co1 {color: #009900; font-style: italic;}&lt;br /&gt;.actionscript3 .co2 {color: #009966; font-style: italic;}&lt;br /&gt;.actionscript3 .coMULTI {color: #3f5fbf;}&lt;br /&gt;.actionscript3 .br0 {color: #000000;}&lt;br /&gt;.actionscript3 .sy0 {color: #000066; font-weight: bold;}&lt;br /&gt;.actionscript3 .st0 {color: #990000;}&lt;br /&gt;.actionscript3 .nu0 {color: #000000; font-weight:bold;}&lt;br /&gt;.actionscript3 .me0 {color: #000000;}&lt;br /&gt;.actionscript3 span.xtra { display:block; }&lt;br /&gt;&lt;br /&gt;--!&gt;&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;I've found an &lt;span style="font-weight:bold;"&gt;awesome&lt;/span&gt; AS3 tutorial! It's on &lt;a href="http://gamedev.michaeljameswilliams.com/as3-avoider-game-tutorial-base/"&gt;Michael James William's blog&lt;/a&gt; and it's all about creating your own 'Avoider' game using Action Script 3... speaking of AS3 - holy cow it's different from AS2, this isn't some minor revision! It's like learning a whole new language. Kinda reminds me of when I was learning C++ because it's more OOP.&lt;br /&gt;Anyways, Mike's (can I call you Mike?) tutorial - which is using &lt;a href="http://www.frozenhaddock.co.uk"&gt;FrozenHaddock's Avoider Game tutorial&lt;/a&gt; and upgrading it to AS3 - is a great resource for learning AS3, and if you're just starting to play with Flash that's where you want to begin. So go there, check it out! Participate in the comments if you have a problem... I know I will be :)&lt;br /&gt;&lt;br /&gt;Included with the later 'chapters' of his tutorial are some 'challenges' - I love this part! The purpose of his tutorial isn't just to walk you through doing everything. Like a good teacher, he sets out some goals for you to try to accomplish on your own, and then provides support if (WHEN) you need it by means of the comments section.&lt;br /&gt;&lt;br /&gt;If you haven't gone through the tutorial yet, go do it! I'm going to post what I did on some of the challenges here.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Chapter 7 Challenges&lt;/span&gt;&lt;br /&gt;One of the challenges is creating a second button on the menu screen, so that one would start the game with mouse control and the other with keyboard control. I mulled over this for three days!&lt;br /&gt;&lt;br /&gt;My first step was to duplicate the startButton in AvoiderGame.fla, I named the instance of the copy - kbStartButton. I also edited the button so that when I hovered my mouse over it it said "Keyboard" and the original startButton says "Mouse"&lt;br /&gt;&lt;br /&gt;My next steps were in creating an event listener for my 'keyboard control' button (I named the instance &lt;span style="font-style:italic;"&gt;kbStartButton&lt;/span&gt; (Line 4 in the code below)&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw3"&gt;function&lt;/span&gt; MenuScreen&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; startButton&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;addEventListener&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; &lt;a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"&gt;&lt;span class="kw5"&gt;MouseEvent&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw8"&gt;CLICK&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt; onClickMouse &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; kbStartButton&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;addEventListener&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; &lt;a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"&gt;&lt;span class="kw5"&gt;MouseEvent&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw8"&gt;CLICK&lt;/span&gt;&lt;span class="sy0"&gt;,&lt;/span&gt; onClickKeyboard &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; &lt;a href="http://www.google.com/search?q=mouse%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouse.html"&gt;&lt;span class="kw5"&gt;Mouse&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;show&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You notice, I also changed &lt;span style="font-style:italic;"&gt;onClickStart&lt;/span&gt; to &lt;span style="font-style:italic;"&gt;onClickMouse&lt;/span&gt;.&lt;br /&gt;And also in the function...&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw3"&gt;function&lt;/span&gt; onClickMouse&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; event&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"&gt;&lt;span class="kw5"&gt;MouseEvent&lt;/span&gt;&lt;/a&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;span class="kw1"&gt;void&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw7"&gt;dispatchEvent&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; &lt;span class="kw1"&gt;new&lt;/span&gt; NavigationEvent&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; NavigationEvent&lt;span class="sy0"&gt;.&lt;/span&gt;MOUSE &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Plus&lt;/span&gt; a new function that we referenced in the event listener (&lt;span style="font-style:italic;"&gt;onClickKeyboard&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw3"&gt;function&lt;/span&gt; onClickKeyboard&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; event&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"&gt;&lt;span class="kw5"&gt;MouseEvent&lt;/span&gt;&lt;/a&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;span class="kw1"&gt;void&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw7"&gt;dispatchEvent&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; &lt;span class="kw1"&gt;new&lt;/span&gt; NavigationEvent&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; NavigationEvent&lt;span class="sy0"&gt;.&lt;/span&gt;KEYBOARD &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;We referenced a .MOUSE and a .KEYBOARD navigation event, so go to our NavigationEvent.as file and add:&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; static const RESTART&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"&gt;&lt;span class="kw5"&gt;String&lt;/span&gt;&lt;/a&gt; = &lt;span class="st0"&gt;&amp;quot;restart&amp;quot;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; static const START&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"&gt;&lt;span class="kw5"&gt;String&lt;/span&gt;&lt;/a&gt; = &lt;span class="st0"&gt;&amp;quot;start&amp;quot;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; static const MENU&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"&gt;&lt;span class="kw5"&gt;String&lt;/span&gt;&lt;/a&gt; = &lt;span class="st0"&gt;&amp;quot;menu&amp;quot;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; static const KEYBOARD&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"&gt;&lt;span class="kw5"&gt;String&lt;/span&gt;&lt;/a&gt; = &lt;span class="st0"&gt;&amp;quot;keyboard&amp;quot;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; static const MOUSE&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"&gt;&lt;span class="kw5"&gt;String&lt;/span&gt;&lt;/a&gt; = &lt;span class="st0"&gt;&amp;quot;mouse&amp;quot;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, going back to the DocumentClass.as file, change your constructor to:&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw3"&gt;function&lt;/span&gt; DocumentClass&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; menuScreen = &lt;span class="kw1"&gt;new&lt;/span&gt; MenuScreen&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; menuScreen&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;addEventListener&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; NavigationEvent&lt;span class="sy0"&gt;.&lt;/span&gt;KEYBOARD&lt;span class="sy0"&gt;,&lt;/span&gt; onRequestStart &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&amp;nbsp; &amp;nbsp; menuScreen&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;addEventListener&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; NavigationEvent&lt;span class="sy0"&gt;.&lt;/span&gt;MOUSE&lt;span class="sy0"&gt;,&lt;/span&gt; onRequestStart &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; menuScreen&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;x&lt;/span&gt; = &lt;span class="nu0"&gt;0&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; menuScreen&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;y&lt;/span&gt; = &lt;span class="nu0"&gt;0&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="kw7"&gt;addChild&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; menuScreen &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Go down to the onRequestStart function, and add this to the top:&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;navigationEvent&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;type&lt;/span&gt; == &lt;span class="st0"&gt;&amp;quot;keyboard&amp;quot;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; useMouseControl = &lt;span class="kw1"&gt;false&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li2"&gt;&lt;div class="de2"&gt;&lt;span class="kw1"&gt;if&lt;/span&gt;&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;navigationEvent&lt;span class="sy0"&gt;.&lt;/span&gt;&lt;span class="kw7"&gt;type&lt;/span&gt; == &lt;span class="st0"&gt;&amp;quot;mouse&amp;quot;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; useMouseControl = &lt;span class="kw1"&gt;true&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now, go to AvoiderGame.as - don't worry, we'll be back here in a minute!&lt;br /&gt;&lt;br /&gt;Create a variable for choosing the mouse, I called it &lt;span style="font-style:italic;"&gt;iChooseMouse&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw2"&gt;var&lt;/span&gt; iChooseMouse&lt;span class="sy0"&gt;:&lt;/span&gt;&lt;a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"&gt;&lt;span class="kw5"&gt;Boolean&lt;/span&gt;&lt;/a&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;and change the constructor for AvoiderGame to accept this new variable. While you're at it, add a line that makes useMouseControl equal to iChooseMouse.&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="kw1"&gt;public&lt;/span&gt; &lt;span class="kw3"&gt;function&lt;/span&gt; AvoiderGame&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; iChooseMouse &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&amp;nbsp; &amp;nbsp; useMouseControl = iChooseMouse&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;&lt;span class="sy0"&gt;...&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now, stroll back to DocumentClass.as and change every instance of&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;playScreen = &lt;span class="kw1"&gt;new&lt;/span&gt; AvoiderGame&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;to...&lt;br /&gt;&lt;br /&gt;&lt;div class="actionscript3" style="font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;"&gt;&lt;ol&gt;&lt;li class="li1"&gt;&lt;div class="de1"&gt;playScreen = &lt;span class="kw1"&gt;new&lt;/span&gt; AvoiderGame&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt; useMouseControl &lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;span class="sy0"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Save all your .AS files and give it a test run. Should work!&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-7051579678353414136?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/7051579678353414136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2009/07/reclaiming-my-zeal.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/7051579678353414136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/7051579678353414136'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2009/07/reclaiming-my-zeal.html' title='Reclaiming my zeal!'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-7840565741381104789</id><published>2007-12-12T12:10:00.000-08:00</published><updated>2008-12-24T10:59:17.252-08:00</updated><title type='text'>Slacker!!!</title><content type='html'>I start a blog, and then take a hiatus from doing Flash... what's up with that?&lt;br /&gt;What can I say? It got busy around work, and I didn't have much time to work on the Blog. But now I've got this zeal. I want to write, so I'm back.  I'm working on getting the actionscript code to look better. In doing so I totally screwed up the code in my post, so I'll have to remember where I was at and redo it. But it's all for the best...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-7840565741381104789?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/7840565741381104789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2007/12/slacker.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/7840565741381104789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/7840565741381104789'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2007/12/slacker.html' title='Slacker!!!'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-8240280093138015415</id><published>2007-10-02T13:56:00.000-07:00</published><updated>2008-12-24T11:00:32.347-08:00</updated><title type='text'>Getting Started</title><content type='html'>First, I'd like to thank (and plug) the &lt;a href="http://www.actionscript.org/forums/"&gt;http://www.actionscript.org/forums/&lt;/a&gt; which I wholeheartedly encourage you to join and participate on, and &lt;a href="http://www.emanueleferonato.com/"&gt;http://www.emanueleferonato.com/&lt;/a&gt; since Emanuele's blogs kick butt.&lt;br /&gt;&lt;br /&gt;Creating Our Hero&lt;br /&gt;&lt;br /&gt;I’m going to assume you already Flash installed. If not, you’ll probably wanna go skim your installation documentation. This is a bit embarrassing, but when I first opened Flash, I was given the options of Create [a] New ‘Flash File’, ‘ActionScript File’, ‘Flash Project’… Ummm… I didn’t know which one to pick. I dinked around, trying to figure it out. Finally I read some tutorials and downloaded their source files (.fla) only to delete everything out and save the blank one as my own. …then I figured out I just choose ‘Flash File’, and since most of the tutorials I find (this one included) are still using ActionScript 2.0, that’s the one I pick too (yep, follllow the crowd)&lt;br /&gt;&lt;br /&gt;So, now you’ve got a blank workspace –probably with a size of 550 x 400. One layer, and one frame. If you pressed Ctrl + Enter to test the movie, you’d see a lovely scene full of nothingness.&lt;br /&gt;&lt;br /&gt;Quite beautiful in a minimalist sort of way.&lt;br /&gt;&lt;br /&gt;We're going to make a little ship, or ball... my ship looks like a ball, and for that matter is gonna bounce like one too!&lt;br /&gt;&lt;br /&gt;Go up to the menu bar, and click View &gt; Grid &gt; Edit Grid (or Press Ctrl + Alt + G) If it's not selected, click Show grid. Click Snap to Grid (or Press Ctrl + Shift + ' later), and change the grid width and height to 20 px x 20 px.&lt;br /&gt;&lt;br /&gt;Click Modify &gt; Document (Ctrl+J). You'll see the dimensions of your project, by default 550px x 400px. In this window, change the Frame rate to 40 fps.&lt;br /&gt;&lt;br /&gt;Click OK, then select the Oval tool in your tools palette (or Press 'O'). Also in the tools palette, pick a fill color for your ship. Pick a color, any color! I'm gonna go with #FF6600 - the color formerly known as orange. I like having a nice, thick border on my images, you can do this too. In the properties inspector (by default down at the bottom), you can choose the thickness of the border, change that to 3.&lt;br /&gt;&lt;br /&gt;Now we get to create something!&lt;br /&gt;&lt;br /&gt;Hold shift while you click and drag your mouse to make a 2 x 2 square circle (40px x 40px ...did I just direct you to create a square circle??). Wow, impressive ship you have there, huh?&lt;br /&gt;&lt;br /&gt;Now we want to add something so we'll know which way the ship is facing. Undo Snap to grid (ctrl+shift+'), change your fill color to something else, and create an oval shape on the left side of the ship.&lt;br /&gt;&lt;br /&gt;Does your mouse keep jumping around when you're trying to make an oval? Press Ctrl+Shift+/ to take off Snapping to Objects and try again.&lt;br /&gt;&lt;br /&gt;Use the selection tool now (V), and highlight the entire ship by clicking and dragging a box around it. Now on the menu bar, click Modify &gt; Convert to Symbol (F8), and name it ship. Remember that Flash is case-sensitive (i.e. ship is not the same as Ship or shiP or sHIp or Battlestar-Galactica) Make sure the 'Type' is Movie Clip, and click the box that says 'Export for ActionScript'&lt;br /&gt;&lt;br /&gt;Lovely!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;embed src="http://home.comcast.net/~spamness/tutimg/ship-tut1.swf" width="550" height="400" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Not too terribly exciting, but at least it's efficient. You won't see this one crashing too many systems!&lt;br /&gt;&lt;br /&gt;With your ship still selected, press Delete. It's okay! We've added it to our library (there's a panel on the right side of the screen) where we can grab an instance of it at any time.&lt;br /&gt;Giving Our Hero Some Action&lt;br /&gt;&lt;br /&gt;Now we've got a blank workspace again, that's okay. We'll add our ship back in using ActionScript!&lt;br /&gt;Press F9 (Window &gt; Actions on the Menu Bar)&lt;br /&gt;&lt;br /&gt;&lt;div style="MARGIN-BOTTOM: 2px; FONT: 11px verdana, geneva, lucida; COLOR: #000000"&gt;Actionscript Code:&lt;/div&gt;&lt;br /&gt;&lt;pre style="BORDER-RIGHT: 1px inset; PADDING-RIGHT: 6px; BORDER-TOP: 1px inset; PADDING-LEFT: 6px; BACKGROUND: #e3eaec; PADDING-BOTTOM: 6px; MARGIN: 0px; OVERFLOW: auto; BORDER-LEFT: 1px inset; WIDTH: 100%; COLOR: #000000; PADDING-TOP: 6px; BORDER-BOTTOM: 1px inset; TEXT-ALIGN: left"&gt;&lt;br /&gt;&lt;br /&gt; start_y=150;&lt;br /&gt;&lt;br /&gt; start_x=150; &lt;p&gt;&lt;br /&gt; onenterframe=function(){&lt;br /&gt;&lt;br /&gt;        &lt;em&gt;movieclipname&lt;/em&gt;._x=start_x;&lt;br /&gt;        &lt;em&gt;movieclipname&lt;/em&gt;._y=start_y;&lt;br /&gt; }&lt;/p&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;embed src="http://home.comcast.net/~spamness/tutimg/ship-tut2.swf" width="550" height="400" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;br /&gt;More to come....&lt;br /&gt;&lt;pre&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-8240280093138015415?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/8240280093138015415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2008/12/getting-started.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/8240280093138015415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/8240280093138015415'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2008/12/getting-started.html' title='Getting Started'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4540916209089598519.post-8054549199325900847</id><published>2007-10-01T15:10:00.000-07:00</published><updated>2008-12-24T10:59:58.335-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='first'/><category scheme='http://www.blogger.com/atom/ns#' term='genesis'/><category scheme='http://www.blogger.com/atom/ns#' term='beginning'/><category scheme='http://www.blogger.com/atom/ns#' term='no flash'/><title type='text'>In the beginning...</title><content type='html'>there was blog.&lt;br /&gt;So this is it. I've decided to start a blog.&lt;br /&gt;Why would I do this when I have little to say outside of cyberspace (you may or may not be asking...)?&lt;br /&gt;Because I've decided to add Actionscript to my forté. So this will be my journey. I've already been working on it for two or three weeks, so it won't be my &lt;em&gt;entire&lt;/em&gt; journey. But you can be here for most of it.&lt;br /&gt;...and maybe I can help you learn a thing or too if you're interested in Flash, Actionscript, Photoshop, or something completely different. I just don't know how this blog will evolve.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4540916209089598519-8054549199325900847?l=bigfootstudios.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigfootstudios.blogspot.com/feeds/8054549199325900847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigfootstudios.blogspot.com/2008/12/in-beginning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/8054549199325900847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4540916209089598519/posts/default/8054549199325900847'/><link rel='alternate' type='text/html' href='http://bigfootstudios.blogspot.com/2008/12/in-beginning.html' title='In the beginning...'/><author><name>Bigfoot</name><uri>http://www.blogger.com/profile/05694521867590807439</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_EHHKCICJFDc/Smjl7nN980I/AAAAAAAAAAM/PcJDxmsajR8/s1600-R/f1760f8fc8ffb7c05d6a4dc8b1d6b150.png'/></author><thr:total>0</thr:total></entry></feed>
