<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.1.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Interactive Crap</title>
	<link>http://www.interactivecrap.com</link>
	<description>Flash Game Programming and some other random crap</description>
	<pubDate>Mon, 12 Jul 2010 21:26:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.3</generator>
	<language>en</language>
			<item>
		<title>Building XML with variables AS3</title>
		<link>http://www.interactivecrap.com/?p=88</link>
		<comments>http://www.interactivecrap.com/?p=88#comments</comments>
		<pubDate>Mon, 12 Jul 2010 21:21:12 +0000</pubDate>
		<dc:creator>nate</dc:creator>
		
		<category><![CDATA[AS 3]]></category>

		<guid isPermaLink="false">http://www.interactivecrap.com/?p=88</guid>
		<description><![CDATA[Honestly, I didn&#8217;t think this little test would work.  But you can actually build out XML with variables.  Here is a very simple example:

var tag:String = "tag";
var id:String = "Step";
var attribute:String = "id"
var xml:XML = Value In Tag 

Seems obvious, but I still thought it was pretty cool.  Also, there should be [...]]]></description>
			<content:encoded><![CDATA[<p>Honestly, I didn&#8217;t think this little test would work.  But you can actually build out XML with variables.  Here is a very simple example:</p>
<p><code><br />
var tag:String = "tag";<br />
var id:String = "Step";<br />
var attribute:String = "id"</p>
<p>var xml:XML = <{tag} {attribute}={id}>Value In Tag<{tag}> </p>
<p></code></p>
<p>Seems obvious, but I still thought it was pretty cool.  Also, there should be a &#8220;/&#8221; before that last &#8220;{tag}&#8221;, but WordPress wouldn&#8217;t render it right and I don&#8217;t know the trick to get it to show right.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivecrap.com/?feed=rss2&amp;p=88</wfw:commentRss>
		</item>
		<item>
		<title>Facebook Data Store API</title>
		<link>http://www.interactivecrap.com/?p=89</link>
		<comments>http://www.interactivecrap.com/?p=89#comments</comments>
		<pubDate>Thu, 08 Apr 2010 01:33:37 +0000</pubDate>
		<dc:creator>nate</dc:creator>
		
		<category><![CDATA[AS 3]]></category>

		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://www.interactivecrap.com/?p=89</guid>
		<description><![CDATA[I recently gave a presentation on this over at MN SWF Camp this last Monday.  There has been a lot of ambiguity on how this API actually works and I hope this presentation and code clears up some of the questions.  If you have any further questions feel free to contact me at: [...]]]></description>
			<content:encoded><![CDATA[<p>I recently gave a presentation on this over at MN SWF Camp this last Monday.  There has been a lot of ambiguity on how this API actually works and I hope this presentation and code clears up some of the questions.  If you have any further questions feel free to contact me at: nate __ AT __ trycatchgames (dot here) com</p>
<p>Presentation:<br />
www.pacyga.com/facebook/whackamole/presentation.swf</p>
<p>Code:<br />
www.pacyga.com/facebook/whackamole/whackamole.zip</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivecrap.com/?feed=rss2&amp;p=89</wfw:commentRss>
		</item>
		<item>
		<title>Preloading in AS3</title>
		<link>http://www.interactivecrap.com/?p=87</link>
		<comments>http://www.interactivecrap.com/?p=87#comments</comments>
		<pubDate>Thu, 10 Sep 2009 19:39:58 +0000</pubDate>
		<dc:creator>nate</dc:creator>
		
		<category><![CDATA[AS 3]]></category>

		<guid isPermaLink="false">http://www.interactivecrap.com/?p=87</guid>
		<description><![CDATA[Honestly, I never really had a problem with preloading in AS3 previously.  Mainly because of my friends over at Urban Squall with their post on the last preloader you&#8217;ll ever need, which can be found here.  Then a friend of mine wanted to preload his swf while coding in an FLA or in [...]]]></description>
			<content:encoded><![CDATA[<p>Honestly, I never really had a problem with preloading in AS3 previously.  Mainly because of my friends over at Urban Squall with their post on the last preloader you&#8217;ll ever need, which can be found <a href="http://www.gamepoetry.com/blog/2008/05/30/the-last-preloader-youll-ever-need/">here.</a>  Then a friend of mine wanted to preload his swf while coding in an FLA or in a document class, which I didn&#8217;t know the answer to.  Because I usually code with the Flex SDK, thus you can&#8217;t use Urban Squall&#8217;s [Frame] tag solution.</p>
<p>The solutions that people are throwing around is simply using &#8220;loaderInfo.addEventListener(Event.COMPLETE, myFunctionHere)&#8221; and putting that in their document class or first frame of their timeline.  This doesn&#8217;t work.  That is unless you are putting everything after the first frame of your movie.  But for peeps that are creating robust apps and games, they are exporting assets in their library.  These will NOT be preloaded with code on the first frame.</p>
<p>So let&#8217;s recap the various solutions and see if they work:<br />
Everything exporting or on the first frame with preload code &#8212; It will NOT preload everything<br />
JUST preload code on the first frame and everything on the second frame or beyond &#8212; This DOES work<br />
Have a shell SWF that is completely light weight (like 5-10k) that just loads in the content swf &#8212; This solution would work as well</p>
<p>I honestly don&#8217;t like any of these.  I am glad that I 99.9% of the time work with the Flex SDK and can use slightly more eligant solutions like using the [Frame] tag and sticking a class to monitor everything before the shit hits the fan in the document class.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivecrap.com/?feed=rss2&amp;p=87</wfw:commentRss>
		</item>
		<item>
		<title>Getting the short file name</title>
		<link>http://www.interactivecrap.com/?p=86</link>
		<comments>http://www.interactivecrap.com/?p=86#comments</comments>
		<pubDate>Thu, 23 Jul 2009 01:51:16 +0000</pubDate>
		<dc:creator>nate</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.interactivecrap.com/?p=86</guid>
		<description><![CDATA[I am working with Flex Builder 3 currently and I have just exported ASDocs for my code base.  But not without a bit of frustration.  In the case, anyone else is looking for the command in for a DOS-prompt to spit out a short file name format (whatever its called), the command is: [...]]]></description>
			<content:encoded><![CDATA[<p>I am working with Flex Builder 3 currently and I have just exported ASDocs for my code base.  But not without a bit of frustration.  In the case, anyone else is looking for the command in for a DOS-prompt to spit out a short file name format (whatever its called), the command is: &#8220;command /z&#8221;.  I didn&#8217;t know this and it took me a while to find.</p>
<p>The context for all of this is that when you&#8217;re trying to hook your ASDoc tool to an SWC file source you need to add this line: -external-library-path=/Docume~1/NatePa~1/MyDocu~1/Projects/Allen_~2/  And all those &#8220;~1&#8243; and &#8220;~2&#8243; make up short file names that you need to use in Eclipse (as far as I know).  Anyways, I know this post is random and just me rambling, but I figure if I help one person with this, it was worth it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivecrap.com/?feed=rss2&amp;p=86</wfw:commentRss>
		</item>
		<item>
		<title>UML and AS 3</title>
		<link>http://www.interactivecrap.com/?p=85</link>
		<comments>http://www.interactivecrap.com/?p=85#comments</comments>
		<pubDate>Wed, 22 Jul 2009 20:59:24 +0000</pubDate>
		<dc:creator>nate</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.interactivecrap.com/?p=85</guid>
		<description><![CDATA[I am currently working on a project where I wanted to model out the program and do a lot of up front planning.  I wanted to find a UML tool that would be cheap (or free!) and would kick out AS3 code.  Luckily, I did find such a tool and setup and for [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently working on a project where I wanted to model out the program and do a lot of up front planning.  I wanted to find a UML tool that would be cheap (or free!) and would kick out AS3 code.  Luckily, I did find such a tool and setup and for a free setup its fantastic!  </p>
<p>Check out <a href="http://staruml.sourceforge.net/en/"> Star UML here.</a></p>
<p>Then check out a post very helpful post for the AS 3 code generation plug-in <a href="http://www.digitaldogbyte.com/2008/02/18/uml-actionscript-30-code-generation/"> here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivecrap.com/?feed=rss2&amp;p=85</wfw:commentRss>
		</item>
		<item>
		<title>4k Flash Game Competition</title>
		<link>http://www.interactivecrap.com/?p=84</link>
		<comments>http://www.interactivecrap.com/?p=84#comments</comments>
		<pubDate>Thu, 26 Feb 2009 23:03:37 +0000</pubDate>
		<dc:creator>nate</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.interactivecrap.com/?p=84</guid>
		<description><![CDATA[Its ON!  The 4k competition put by Urban Squall and Gaming Your Way, has been getting a lot of positive press around the net and a rousing response from the Flash game development community.  Personally, I have completed my entry and plan on turning it in around the deadline time of March 9th. [...]]]></description>
			<content:encoded><![CDATA[<p>Its ON!  The 4k competition put by <a href="http://www.urbansquall.com">Urban Squall</a> and <a href="http://www.gamingyourway.com">Gaming Your Way</a>, has been getting a lot of positive press around the net and a rousing response from the Flash game development community.  Personally, I have completed my entry and plan on turning it in around the deadline time of March 9th.  It was a lot of fun to make and only took me a few hours to complete, but then, of course, I had to tweak it with graphics, extras and optimization.  </p>
<p>It&#8217;s good to keep your skills sharp with these types of contests and to have a face in the Flash game development community.  Lots of my personal close friends (in real life) are doing the competition as well. Minnesota represent!  If you would like to learn more about the contest check it out <a href="http://www.gamepoetry.com/blog/2009/02/06/flash-4k-game-competition-prizes-and-rules/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivecrap.com/?feed=rss2&amp;p=84</wfw:commentRss>
		</item>
		<item>
		<title>Ginger: Using it for uniform sprite sheet rendering</title>
		<link>http://www.interactivecrap.com/?p=82</link>
		<comments>http://www.interactivecrap.com/?p=82#comments</comments>
		<pubDate>Sat, 21 Feb 2009 22:08:27 +0000</pubDate>
		<dc:creator>nate</dc:creator>
		
		<category><![CDATA[Flash Game Programming]]></category>

		<category><![CDATA[AS 3]]></category>

		<guid isPermaLink="false">http://www.interactivecrap.com/?p=82</guid>
		<description><![CDATA[Panayoti over at Urban Squall runs a fantastic blog called Game Poetry, there he posts great advice on all things for Flash gaming.  One of his posts found here is about improving performance with animated bitmaps.  In a nutshell it describes a code project that he has started up to create and manage [...]]]></description>
			<content:encoded><![CDATA[<p>Panayoti over at <a href="http://www.urbansquall.com">Urban Squall</a> runs a fantastic blog called <a href="http://www.gamepoetry.com/blog/">Game Poetry</a>, there he posts great advice on all things for Flash gaming.  One of his posts found <a href="http://www.gamepoetry.com/blog/2008/10/31/improving-performance-with-animated-bitmaps/">here</a> is about improving performance with animated bitmaps.  In a nutshell it describes a code project that he has started up to create and manage bitmap animations from a sprite sheet.  At the end of the post he sent out a call to developers to help him out with specification for external data for creating animations.  I helped out and came up with my own, however it is now dated.  <img src='http://www.interactivecrap.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Despite that I am encouraging you to check out the blog post and the project to whom ever wants a simple and clean implementation of managing animated bitmaps in your games or apps.  You can check out my implementation <a href='http://www.interactivecrap.com/wp-content/uploads/2009/02/ginger_load_xml.zip' title='Ginger_By_XML'>here</a>.</p>
<p>Basically all that is happening in this example project is under the trycatchgames folder is my implementation of Urban Squall&#8217;s bitmap animation framework, which has since been updated.  In the Main class you can see how I am using XML to define an animation, create it using the animation builder, add it to the controller and play it.  By using the unified animation controller we are able to add one to many bitmap animations and retrieve them when needed.  It should also be noted that even if you don&#8217;t have rotation in your sprite sheet that you are able to add rotation if you so desire.  On bitmap animation creation you are able to specify the number of degrees in your rotation.</p>
<p>Check out the example project and the newest one in the Urban Squall code repo found <a href="http://code.google.com/p/gamepoetry/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivecrap.com/?feed=rss2&amp;p=82</wfw:commentRss>
		</item>
		<item>
		<title>Analyzing Sound in AS3</title>
		<link>http://www.interactivecrap.com/?p=80</link>
		<comments>http://www.interactivecrap.com/?p=80#comments</comments>
		<pubDate>Tue, 06 Jan 2009 22:07:21 +0000</pubDate>
		<dc:creator>nate</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[AS 3]]></category>

		<guid isPermaLink="false">http://www.interactivecrap.com/?p=80</guid>
		<description><![CDATA[I have been wanting to build a game that builds worlds/enemies/properties off a given music file for some time.  There are some decent games out there that are making such strides, one of which is Tube Rockers.  I like that game because it involves people making custom tracks to music videos found on [...]]]></description>
			<content:encoded><![CDATA[<p>I have been wanting to build a game that builds worlds/enemies/properties off a given music file for some time.  There are some decent games out there that are making such strides, one of which is Tube Rockers.  I like that game because it involves people making custom tracks to music videos found on You Tube.  Pretty cool.</p>
<p>However, with Flash 10 we have the ability, with the users permission, to read and write to their hard drive.  Finally.  I know I can say this for every Flash/Flex developer out there that we have been waiting for this since&#8230; well&#8230; Flash was created really.  And now without round tripping to the server!  Yay!</p>
<p>Analyzing sound in Flash has been around since SoundMixer.computeSpectrum() was introduced in Flash 8.  Using this, along with the read capabilities of Flash 10 we can bring in any mp3 a user would like to play in a game.  This is where the idea stems from.  Try Catch Games (www.trycatchgames.com) my casual game company is currently concepting such a music game, more on that to come.</p>
<p>Now to talk about sound.  Here are some stats:</p>
<p>Human Hearing: 20 to 20,000 Hz</p>
<p>Bass: 20 Hz - 250 Hz Mids: 250 Hz - 6 kHz Highs: 5 kHz - 20 kHz</p>
<p>Bass Drum: 50 Hz - 5.5 kHz Thump: 50 Hz - 100 Hz Punch/Slap: 2.5 kHz - 5 kHz</p>
<p>Cymbals: 300 Hz - 17 kHz Presence: 10 kHz - 14 kHz</p>
<p>Snare: 100 Hz - 12 kHz Center: 1 kHz Tight: 5 kHz - 6 kHz Crack: 8 kHz - 10 kHz</p>
<p>Toms: 4 kHz - 5.5 kHz and 9 kHz - 10 kHz</p>
<p>***</p>
<p>I am going to assume that readers of this blog know a thing or two about sound.  If not, check out a wiki and come back.</p>
<p>A lot of you are probably asking &#8220;What does this guy know about Flash that I don&#8217;t to analyze sound?&#8221;.  Really the answer is, nothing.  I just want to give out some information that I have found out to further your journey into building better Flash games or apps.  Let&#8217;s jump in.</p>
<p>Checking out the computeSpectrum method in the SoundMixer object you will find a few params:<br />
computeSpectrum(outputArray:ByteArray, FFTMode:Boolean = false, stretchFactor:int = 0)</p>
<p>The params I am going to focus on are the last two and what to do with that data.  First, for the data that I want I set FFTMode to true because I am interested in the frequency spectrum instead of the raw sound wave.  With this frequency data I want to filter out (as best as possible) values that tell me when something is happening.  This &#8220;something&#8221; would be a beat, vocals or guitar.  Now I have to say from the onset that my filtering isn&#8217;t really that great&#8230;yet.  But I believe with the capabilities of extracting raw sound data from an MP3 and computeSpectrum (or one or the other) will help me accomplish my goal more accurately.  For now, I am analyzing on-the-fly and averaging values based on what I think a beat is.</p>
<p>The next param is the stretchFactor.  I believe this to be important to be tweaked as we can drill down to the frequencies that are interesting to us.  In my experiment I am using the values of 3 and 5, which give us a stretch to the frequencies of 5512 and 1378 respectively.  Now I obviously use the 1378 frequency stretch for testing for sound data in the lower spectrum (which covers a lot of sound actually) which is mostly beats, bass guitar and some voice depending on the music.  The higher one, 5512, would be used for higher frequencies like violin and female voice.  </p>
<p>For some simple formulas in finding these frequency ranges I have hard coded x and y point values.  This can be found by the frequency max limit, which for the lower one would be 1378, then divide that by 512, as this is the number of channels.  You will find that each &#8220;slice&#8221; will be about 2.69.  This means that within each of these slices it will cover a particular frequency range.  In the case of covering 0Hz - 100Hz you would divide 100 by 2.69 to find how many slices it occupies.  In my experiment I would sometimes give or take a few slices in some cases.</p>
<p>I know none of this is ground breaking, but I did my fair share of searching and no one has talked about it.  My experiment that I did off of this research is a simple on-the-fly averaging music program that does a little filtering and displays a square when the grouped slices go over the average.  Currently, I am not going to share the source code as its a work in progress but if you would like to check it out contact me directly: nate |at| pacyga |dot| com </p>
<p><a href="http://trycatchgames.com/SoundAnalyze/bin/SoundAnalyze.swf">If you would like to check out my experiment do so here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivecrap.com/?feed=rss2&amp;p=80</wfw:commentRss>
		</item>
		<item>
		<title>Implementing the Kongregate High Scores API</title>
		<link>http://www.interactivecrap.com/?p=79</link>
		<comments>http://www.interactivecrap.com/?p=79#comments</comments>
		<pubDate>Tue, 16 Dec 2008 04:43:19 +0000</pubDate>
		<dc:creator>nate</dc:creator>
		
		<category><![CDATA[Flash Game Programming]]></category>

		<category><![CDATA[AS 3]]></category>

		<category><![CDATA[Kongregate]]></category>

		<guid isPermaLink="false">http://www.interactivecrap.com/?p=79</guid>
		<description><![CDATA[I consider myself an &#8220;alright&#8221; programmer.  So when something that is supposed to be simple in programming frustrates me, I feel like a complete moron.  Enter the Kongregate API, chances are if you are reading this post you have dealt with it in some fashion.  Now if the documentation was all over [...]]]></description>
			<content:encoded><![CDATA[<p>I consider myself an &#8220;alright&#8221; programmer.  So when something that is supposed to be simple in programming frustrates me, I feel like a complete moron.  Enter the Kongregate API, chances are if you are reading this post you have dealt with it in some fashion.  Now if the documentation was all over the place and split up (and done in an actual OOP example) it might actually make some since.  Hence the reason for this post.  I hope to clear things up a bit.</p>
<p>First, to check out the documentation <a href="http://www.kongregate.com/forums/4/topics/3064">here</a>.  Nice huh?  Well hopefully I don&#8217;t screw it up more.  You will notice that there are few options to which you can implement said API.  I recommend the SWC since you can have code hinting and its right there at your disposal.  Or you can go with downloading it remotely (this post does not deal with the component).  If you decide to download it at runtime check out this <a href="http://www.digitalmachina.com/archives/2007/12/06/how-to-integrate-the-kongregate-as3-api-into-your-game-at-runtime/">guys post</a>.  If you do go with that dude&#8217;s way make sure you listen to the KongregateEvent.COMPLETE event. (this is what threw me off completely)</p>
<p>Ok, so this is going to be short and sweet.  When you use the SWC way I recommend having a reference to it that you can access from anywhere.  Let&#8217;s not argue about OOP practices and evil singletons, just roll with it.  I like to throw a reference to it in my &#8220;Model&#8221; which I have access to anywhere, this could be said about any class that you are storing persistent data through out your game.  Then in your &#8220;Main&#8221; or Document class make a new KongregateAPI (NOT getInstance() like the docs say and then listen for the KongregateEvent.COMPLETE event.  Those two things completely threw me off because I heard different stories from different sources&#8230; as dumb as that makes me look.  Then finally where you want submit a score do so in your &#8220;Results&#8221; class. (Imports NOT included in code, I assume you are just putting those in)</p>
<p>In your &#8220;Model&#8221;:<br />
<code>public var kongregate:KongregateAPI;</code></p>
<p>In your &#8220;Main&#8221; or Document Class:<br />
<code>Security.allowDomain('http://www.kongregate.com');<br />
_model = Model.getInstance();<br />
_model.kongregate = new KongregateAPI();<br />
_model.kongregate.addEventListener(KongregateEvent.COMPLETE, kongInit);<br />
stage.addChild(_model.kongregate);</p>
<p>private function kongInit(event:Event):void {<br />
     _model.kongregate.services.connect();<br />
}</code></p>
<p>In your &#8220;Results&#8221; Class:<br />
<code>_model = Model.getInstance();<br />
_model.kongregate.scores.submit(_score);</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivecrap.com/?feed=rss2&amp;p=79</wfw:commentRss>
		</item>
		<item>
		<title>Hey Hey Shooter: Classic Released!</title>
		<link>http://www.interactivecrap.com/?p=78</link>
		<comments>http://www.interactivecrap.com/?p=78#comments</comments>
		<pubDate>Mon, 08 Dec 2008 05:37:29 +0000</pubDate>
		<dc:creator>nate</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.interactivecrap.com/?p=78</guid>
		<description><![CDATA[Even though I programmed this some time ago, I finally released Hey Hey Shooter: Classic.  I hope you guys enjoy it!  (Damn, I need to blog more&#8230;)
http://www.kongregate.com/games/TryCatchGames/hey-hey-shooter-classic
]]></description>
			<content:encoded><![CDATA[<p>Even though I programmed this some time ago, I finally released Hey Hey Shooter: Classic.  I hope you guys enjoy it!  (Damn, I need to blog more&#8230;)<br />
http://www.kongregate.com/games/TryCatchGames/hey-hey-shooter-classic</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivecrap.com/?feed=rss2&amp;p=78</wfw:commentRss>
		</item>
	</channel>
</rss>
