<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nathandemick.com &#187; Flash</title>
	<atom:link href="http://nathandemick.com/tags/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://nathandemick.com</link>
	<description></description>
	<lastBuildDate>Wed, 14 Dec 2011 22:40:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Nonogram Madness is effectively done</title>
		<link>http://nathandemick.com/2010/01/nonogram-madness-is-effectively-done/</link>
		<comments>http://nathandemick.com/2010/01/nonogram-madness-is-effectively-done/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 01:13:48 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[games]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Video Games]]></category>

		<guid isPermaLink="false">http://nathandemick.com/?p=308</guid>
		<description><![CDATA[Seems like the last two projects I&#8217;ve done have had kind of lackluster ends. I&#8217;ve been sitting on this &#8220;mostly complete&#8221; project for a while, and while I&#8217;m still unsatisfied about certain areas (i.e. there&#8217;s no music), if I don&#8217;t push it out the door pretty soon it&#8217;ll just sit and stagnate. So, here we [...]]]></description>
			<content:encoded><![CDATA[<p>Seems like the last two projects I&#8217;ve done have had kind of lackluster ends. I&#8217;ve been sitting on this &#8220;mostly complete&#8221; project for a while, and while I&#8217;m still unsatisfied about certain areas (i.e. there&#8217;s no music), if I don&#8217;t push it out the door pretty soon it&#8217;ll just sit and stagnate. So, here we go: <a href="http://nathandemick.com/flash/nonogram-madness/" title="Nonogram Madness">Nonogram Madness</a>.</p>
<p>(If anyone cares, let me know what you think in the comments. The puzzles <em>kinda</em> progress in difficulty, but they haven&#8217;t been balanced at all, and some of them are pretty bad. There, you&#8217;ve been warned.)</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2010/01/nonogram-madness-is-effectively-done/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Armada</title>
		<link>http://nathandemick.com/2009/09/armada/</link>
		<comments>http://nathandemick.com/2009/09/armada/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 16:51:04 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[games]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[indie gaming]]></category>
		<category><![CDATA[kongregate]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=254</guid>
		<description><![CDATA[So I finally decided to be &#8220;done&#8221; with this little shooting game I&#8217;ve been working on for a while. It&#8217;s called &#8220;Armada.&#8221; The goal is to destroy 1,000 enemies. Whenever you kill one, another one jumps on the screen to take its place. However, the more enemies you kill, the faster your ship moves and [...]]]></description>
			<content:encoded><![CDATA[<p>So I finally decided to be &#8220;done&#8221; with this little shooting game I&#8217;ve been working on for a while. It&#8217;s called &#8220;Armada.&#8221; The goal is to destroy 1,000 enemies. Whenever you kill one, another one jumps on the screen to take its place. However, the more enemies you kill, the faster your ship moves and shoots. Check it out on <a href="http://www.kongregate.com/games/butr0s/armada?referrer=butr0s" title="Kongregate ">Kongregate</a>.</p>
<p>One thing I&#8217;ve learned about myself during its development is that I can get really bogged down working on more than one thing at a time. My personal programming time is so limited that having two active projects slows things down considerably. Plus, if a project takes too long, I lose motivation pretty quickly. When waking up early in the morning, one has to be excited about what one is doing (an aside: <a href="http://www.wired.com/geekdad/2009/02/10-tricks-to-ge/" title="tips for waking up early on Wired.com">tips for waking up early</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2009/09/armada/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wonderfl</title>
		<link>http://nathandemick.com/2009/04/wonderfl/</link>
		<comments>http://nathandemick.com/2009/04/wonderfl/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 18:28:57 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[japan]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[social networking]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=249</guid>
		<description><![CDATA[This isn&#8217;t exactly news, but I created an account on the Japanese social network/code sharing site Wonderfl. It&#8217;s kind of cool&#8230; you can use the site to automatically compile Actionscript 3 code, then save it for other people to check out. If you see some code you like, or that sparks a new idea, you [...]]]></description>
			<content:encoded><![CDATA[<p>This isn&#8217;t exactly news, but I <a href="http://wonderfl.kayac.com/user/butr0s" title="created an account">created an account</a> on the Japanese social network/code sharing site <a href="http://wonderfl.kayac.com/" title="Wonderfl">Wonderfl</a>. It&#8217;s kind of cool&#8230; you can use the site to automatically compile Actionscript 3 code, then save it for other people to check out. If you see some code you like, or that sparks a new idea, you can &#8220;fork&#8221; it &mdash; copy it and save your own version. I was kind of surprised&#8230; I added two small demos on Monday, and by Wednesday some other users had already modified my demos. There&#8217;s a lot of random crap, but you can also learn some cool techniques by browsing through the user-submitted code. If you have any interest in Actionscript, you should check it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2009/04/wonderfl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Animation in Actionscript 3</title>
		<link>http://nathandemick.com/2009/03/animation-in-actionscript-3/</link>
		<comments>http://nathandemick.com/2009/03/animation-in-actionscript-3/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 17:21:58 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=241</guid>
		<description><![CDATA[I think one of the main disadvantages of using the Flex compiler to create Flash programs is that animation is a bit more difficult to create (although, to tell the truth, I&#8217;ve never used the Flash IDE enough to be able to compare them). I think for most simple games, you can get away with [...]]]></description>
			<content:encoded><![CDATA[<p>I think one of the main disadvantages of using the Flex compiler to create Flash programs is that animation is a bit more difficult to create (although, to tell the truth, I&#8217;ve never used the Flash IDE enough to be able to compare them). I think for most simple games, you can get away with not animating any of your characters. But once you get into creating games that have more detailed characters, you pretty much need to add some sort of animation. We can do that pretty easily by loading multiple images into a DisplayObjectContainer (such as a Sprite) and then showing/hiding each image in turn. Take a look at the following example:</p>
<pre class="brush:js">
package {
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.utils.getTimer;	// for getTimer()

  // Set SWF FPS, etc.
  [SWF(frameRate='30', width='200', height='200', backgroundColor='0xffffff')]

  public class AnimationExample extends Sprite {

    // For frame rate info
    public var ticks:Number = 0;
    public var framesPerSecond:Number;
    public var frameTimer:Number = 0;
    public var currentAnimationFrame:int = 0;

    // For animation
    [Embed(source="run-1.svg")]
    public var animationFrame1:Class;
    [Embed(source="run-2.svg")]
    public var animationFrame2:Class;
    [Embed(source="run-3.svg")]
    public var animationFrame3:Class;

    public var character:Sprite;

    public function AnimationExample():void {

      // Create new sprite for animation frames
      character = new Sprite();

      // Add frames, hide all but the first one
      character.addChild(new animationFrame1());
      character.addChild(new animationFrame2());
      character.addChild(new animationFrame3());
      character.getChildAt(1).visible = false;
      character.getChildAt(2).visible = false;

      this.addChild(character);

      // This will call the animation function
      this.addEventListener(Event.ENTER_FRAME, enterFrame);
    }

    public function enterFrame(e:Event = null):void {
      // getTimer() provides # of ms since Flash Player started
      var currentTicks:Number = getTimer();

      // Figure out how many seconds each frame is displaying for
      var secondsPerFrame:Number = (currentTicks - ticks) / 1000;

      // For the heck of it, you can also determine FPS
      framesPerSecond = 1 / secondsPerFrame;

      // Set this var for the next iteration
      ticks = currentTicks;

      // Increment the timer
      frameTimer += secondsPerFrame;

      // Compare the frameTimer value against the number of seconds you want each frame to display
      if(frameTimer &gt; 0.5) {
        // Reset the frame timer
        frameTimer = 0;

        // Hide the first frame
        this.character.getChildAt(0).visible = false;

        // Move the last frame up to be first
        this.character.setChildIndex(this.character.getChildAt(2), 0);

        // Show the new first frame
        this.character.getChildAt(0).visible = true;
      }
    }
  }
}
</pre>
<p><a href='http://www.bitter-gamer.com/wp-content/uploads/2009/03/animationexample.zip'>Download the code, .swf, and (bad) graphics.</a></p>
<p>In addition to the <code>setChildIndex()</code> function that swaps the depth of each animation frame, there&#8217;s also some code that obtains the current frame rate, which helps set the speed of the animation. In some games, the motion of all the characters can be limited by a number derived by the frame rate, which helps ensure that the game runs the same speed on different computers. This isn&#8217;t totally necessary in Flash, however, since it&#8217;s possible to limit frame rate by using <code>[SWF(frameRate='XX')]</code> at the beginning of your Actionscript package. </p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2009/03/animation-in-actionscript-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling Papervision3D projects using mxmlc</title>
		<link>http://nathandemick.com/2009/03/compiling-papervision3d-projects-using-mxmlc/</link>
		<comments>http://nathandemick.com/2009/03/compiling-papervision3d-projects-using-mxmlc/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 19:39:49 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[mxmlc]]></category>
		<category><![CDATA[papervision3d]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=238</guid>
		<description><![CDATA[There&#8217;s a new competition going on at TIGsource called the &#8220;Cockpit Compo,&#8221; wherein the design constraint is using a cockpit (or similar HUD). I doubt that I will have time to actually make an entry, but since I&#8217;m using Actionscript/Flash as my language/platform of choice now-a-days, I&#8217;m trying to look into a 3D library for [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a new competition going on at TIGsource called the &#8220;<a href="http://forums.tigsource.com/index.php?topic=4823.0" title="Cockpit Compo">Cockpit Compo</a>,&#8221; wherein the design constraint is using a cockpit (or similar HUD). I doubt that I will have time to actually make an entry, but since I&#8217;m using Actionscript/Flash as my language/platform of choice now-a-days, I&#8217;m trying to look into a 3D library for Actionscript. Papervision3D seems like a favorite, so my next step is to find some tutorials and give &#8216;em a shot. First, though, we have to figure out how to actually compile projects with Papervision.</p>
<p>1. Obtain the (free) Flex SDK, and put it somewhere in your system path. I wrote a post about <a href="http://www.bitter-gamer.com/2009/02/how-to-create-flash-programs-with-actionscript-3-and-the-flex-sdk/" title="setting up your Actionscript development environment">setting up your Actionscript development environment</a>; check it out if you haven&#8217;t done this already.<br />
2. Download the <a href="http://code.google.com/p/papervision3d/" title="Papervision3D compiled library (.swc) or source (.as)">Papervision3D compiled library (.swc) or source (.as)</a>. It doesn&#8217;t really matter which one, as I will explain how to use &#8216;em both.<br />
3a. If you got the .swc, put it in the same directory as your project files and rename it to &#8216;papervision3d.swc&#8217;. When you compile, add the flag <code>-include-libraries papervision3d.swc</code>. That&#8217;s it!<br />
3b. If you got the .as source, extract it and put the &#8216;/org&#8217; directory in the same directory as your project files. Compile as normal, you don&#8217;t need to feed mxmlc any extra flags. </p>
<p>To test out the process, get the &#8220;Simple HelloWorld Example for Papervision3D 2.0&#8243; .zip that&#8217;s on the <a href="http://code.google.com/p/papervision3d/downloads/list" title="Papervision3D downloads page">Papervision3D downloads page</a>. Drop in the .swc or the /org directory (depending on what you downloaded), then compile using the instructions above. I got the .swc, put it in a subdirectory called &#8216;/libs&#8217; within the /src, and compiled with <code>mxmlc Main.as -include-libraries libs/papervision3d.swc</code>. If everything goes the way it should, a .swf will be produced that displays a crazily-textured spinning sphere. </p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2009/03/compiling-papervision3d-projects-using-mxmlc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Add an Event Listener in Actionscript 3</title>
		<link>http://nathandemick.com/2009/02/add-an-event-listener-in-actionscript-3/</link>
		<comments>http://nathandemick.com/2009/02/add-an-event-listener-in-actionscript-3/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 19:32:48 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=218</guid>
		<description><![CDATA[Importing graphics into your Flash program is all well and good. You can create movies or animation, but the real interesting thing is taking user input and having your program react to it. The way to do that in Actionscript is to add &#8220;Event Listeners&#8221; to objects you create. Whenever an event occurs (such as [...]]]></description>
			<content:encoded><![CDATA[<p>Importing graphics into your Flash program is all well and good. You can create movies or animation, but the real interesting thing is taking user input and having your program react to it. The way to do that in Actionscript is to add &#8220;Event Listeners&#8221; to objects you create. Whenever an event occurs (such as a keypress, mouse movement, or whatever), your Event Listener checks to see if it&#8217;s supposed to do anything. If so, then it runs a function with code that you specify. So for example, say the user presses the &#8220;left arrow&#8221; key. Your keyboard input event handler sees this, and runs appropriate code (in this case, it might move a game character left). </p>
<p>One of the most basic events in Actionscript is the &#8220;enter frame&#8221; event. This triggers every time the SWF is redrawn, and basically corresponds to the SWF frame rate. In the following example, we&#8217;re going to create a new class, and add an &#8220;enter frame&#8221; event listener to it, so that whenever a new instance of that class is created, a function will run at frame rate. </p>
<pre class="brush:js">
package {
  import flash.display.Sprite;
  import flash.events.Event;  // Required to add event listeners

  // Set our SWF framerate, width, height, and background color
  [SWF(frameRate='30', width='640', height='480', backgroundColor='0xffffff')]

  public class EventListenerExample extends Sprite {

    [Embed(source="ball.svg")]
    public var BallGraphic:Class;

      // Variables used to store movement data
      private var dx:int = 5;
      private var dy:int = 5;

    public function EventListenerExample():void
    {
      // Create instance of imported graphic
      var b:Sprite = new BallGraphic();

      // Add to this display object
      this.addChild(b);

      // Attach event listener
      // Listen for "ENTER_FRAME" event
      // Run the "enterFrame" function
      this.addEventListener(Event.ENTER_FRAME, enterFrame);
    }

	public function enterFrame(e:Event):void
	{
	  // Increment position
	  this.x += this.dx;
	  this.y += this.dy;

	  // If object passes beyond SWF boundaries,
	  // reverse direction
	  if(this.x &gt;= 640 - this.width || this.x &lt;= 0)
	    this.dx *= -1;
	  if(this.y &gt;= 480 - this.height || this.y &lt;= 0)
	    this.dy *= -1;
	}
  }
}
</pre>
<p>Save this code in a file named &#8216;EventListenerExample.as&#8217;. You can see that we&#8217;ve elaborated a bit on our last example, importing and displaying an SVG graphic. However, this time we add some variables to the class that represent speed (delta-x and delta-y). We attach the event listener by calling <code>this.addEventListener (Event.ENTER_FRAME, enterFrame);</code>. The first argument is the type of event the listener is triggered by, and the second is the name of the function to run when the event is detected. </p>
<p>In the declaration of the &#8216;enterFrame&#8217; function, we pass it details of the event that triggered it by putting <code>e:Event</code> in the arguments list. The function doesn&#8217;t actually use that information, but simply moves our graphic around, bouncing off the &#8220;walls&#8221; of the SWF. Movement is just one possible application of the &#8216;enter frame&#8217; event; collision detection can also be calculated this way, among other things.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2009/02/add-an-event-listener-in-actionscript-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to embed SVG vector graphics with Actionscript</title>
		<link>http://nathandemick.com/2009/02/how-to-embed-svg-vector-graphics-with-actionscript/</link>
		<comments>http://nathandemick.com/2009/02/how-to-embed-svg-vector-graphics-with-actionscript/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 18:39:49 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=207</guid>
		<description><![CDATA[One of the big downsides about not using the Flash IDE for development is that it&#8217;s much more of a hassle to bring graphics into your program. The IDE has a built in vector illustration program, which allows the user to create graphical objects (or import them from Illustrator) and link them right up to [...]]]></description>
			<content:encoded><![CDATA[<p>One of the big downsides about not using the Flash IDE for development is that it&#8217;s much more of a hassle to bring graphics into your program. The IDE has a built in vector illustration program, which allows the user to create graphical objects (or import them from Illustrator) and link them right up to a corresponding Actionscript object. If you&#8217;re making programs with the Flex SDK, however, getting graphics is a bit more of a chore. Fortunately, it&#8217;s not nearly as difficult as programming graphics via Actionscript. </p>
<p><a href="/wp-content/uploads/2009/02/inkscape-1.png"><img src="http://www.bitter-gamer.com/wp-content/uploads/2009/02/inkscape-1-123x150.png" alt="Inkscape &#39;New&#39; File Menu" width="123" height="150" class="alignleft size-thumbnail wp-image-211" /></a>First, you&#8217;ll want to get a vector illustration program. Adobe makes Illustrator, which might be your first thought, but we&#8217;re trying to do things on the cheap here, otherwise we&#8217;d just get the Flash IDE. <a href="http://www.inkscape.org/download/?lang=en" title="Inkscape">Inkscape</a> is a free program which can save files in the <a href="http://en.wikipedia.org/wiki/Scalable_Vector_Graphics" title="SVG (scalable vector graphics)">SVG (scalable vector graphics)</a> format. Grab a copy of Inkscape, and fire it up (OS X users prior to 10.5 will need to <a href="http://www.apple.com/downloads/macosx/apple/macosx_updates/x11formacosx.html" title="install X11">install X11</a>). </p>
<p><a href="/wp-content/uploads/2009/02/inkscape-2.png"><img src="http://www.bitter-gamer.com/wp-content/uploads/2009/02/inkscape-2-132x150.png" alt="Create a circle in Inkscape" width="132" height="150" class="alignright size-thumbnail wp-image-212" /></a></p>
<p>Inkscape starts up by creating a default document, which is much larger than anything we would normally use. From the &#8216;File&#8217; menu, navigate to the &#8216;New 32&#215;32 Icon&#8217; option. Now, in the smaller image, use the &#8216;Circle&#8217; tool to create a circle. Take some time here to play around with Inkscape: experiment with changing the color of the circle, give it a border, do whatever you like. When you&#8217;re satisfied with what you have, click &#8216;Save&#8217; and save the image as a &#8216;Plain SVG.&#8217; Now, create a new Actionscript file in the same directory as the graphic file called &#8216;SVGExample.as&#8217;, and enter the following code:</p>
<pre class="brush:js">
package {
  import flash.display.Sprite;

  public class SVGExample extends Sprite {

    [Embed(source="ball.svg")]
    public var BallGraphic:Class;

    public function SVGExample():void
    {
       var b:Sprite = new BallGraphic();
       b.x = 100;
       b.y = 100;
       addChild(b);
    }
  }
}
</pre>
<p>The way that graphics are embedded is as follows: first, you use the &#8216;Embed&#8217; syntax to specify where the image is, and then you link that embedded asset to a unique class name. Here, I call it &#8220;BallGraphic,&#8221; but you can use anything that makes sense to you. Creating an instance of that class (when I call <code>new BallGraphic()</code>) loads the graphic, and it can then be added to a display object container and shown on the screen. When you compile this code and run the SWF, you should see your graphic on the stage. You can now easily import SVG graphics (or even other image types, such as .gif/.jpg) via Actionscript.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2009/02/how-to-embed-svg-vector-graphics-with-actionscript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to create Flash programs with Actionscript 3 and the Flex SDK</title>
		<link>http://nathandemick.com/2009/02/how-to-create-flash-programs-with-actionscript-3-and-the-flex-sdk/</link>
		<comments>http://nathandemick.com/2009/02/how-to-create-flash-programs-with-actionscript-3-and-the-flex-sdk/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 14:34:50 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=165</guid>
		<description><![CDATA[So, something I&#8217;ve been devoting a bit of my time to recently is learning Actionscript programming. It&#8217;s something that I&#8217;ve been interested in for a while, but never pursued &#8212; mainly because the Flash authoring program (currently CS4) runs around $700 for the full version. Now, if I was a professional, and worked with Flash [...]]]></description>
			<content:encoded><![CDATA[<p>So, something I&#8217;ve been devoting a bit of my time to recently is learning Actionscript programming. It&#8217;s something that I&#8217;ve been interested in for a while, but never pursued &#8212; mainly because the Flash authoring program (currently CS4) runs around $700 for the full version. Now, if I was a professional, and worked with Flash for a living, I&#8217;d have no qualms about dropping that cash. However, it&#8217;s a steep point of entry for a hobbyist.</p>
<p>In a bid to make the Flash platform more of an application environment, Adobe has been promoting a new way to author Flash content, called Flex. Flex uses a mix of XML (for layout) and Actionscript (for logic) to more easily create &#8220;application-like&#8221; programs. Flex is really targeted at the programmer &#8212; development is done through a text editor-based environment (although Adobe has made a Flex Builder program to facilitate UI layout). Now, the benefit here is that while Adobe charges for the premium development environment, the actual XML/Actionscript compiler is available for free. This means that you can create pure-Actionscript programs (read: games) for free!</p>
<p>I&#8217;m going to quickly show you how to set up a development environment for Flash authoring with the Flex 3 SDK. The first step is to <a title="download the SDK" href="http://www.adobe.com/products/flex/flexdownloads/">download the SDK</a>. Click the &#8220;I Agree&#8221; checkbox, and save the .zip somewhere on your computer. It&#8217;s a bit large, weighing in at around 120 megs. Extract the files somewhere when it&#8217;s finished downloading (c:\flex3 on Windows or /Users/yourusername/flex3 on OS X).</p>
<p>You&#8217;ve got the tools, now you need to know how to use them. I primarily use some sort of terminal to do my compiling. For Windows, I recommend <a title="Cygwin" href="http://www.cygwin.com/">Cygwin</a>. OS X users can simply use their Terminal.app program. You&#8217;ll have to let your terminal know where your Flex compiler is, so you don&#8217;t have to type the absolute path each time you want to run it (i.e. so we can type &#8216;mxmlc Myprogram.as&#8217; instead of &#8216;/Home/yourusername/flex3/bin/mxmlc Myprogram.as&#8217;). So we&#8217;ll add the &#8216;flex3/bin&#8217; directory to our system path. Here are instructions for <a href="http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/5445775168.htm">Windows</a> and <a title="OS X" href="http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/">OS X</a>. You&#8217;ll want to add the &#8216;c:\flex3\bin&#8217; directory (Windows) or &#8216;/Users/yourusername/flex3/bin&#8217; (OS X) (or wherever you put the Flex SDK files) to your path. Once you&#8217;ve done that, fire up your terminal and type &#8216;mxmlc -help&#8217;. If you see a bunch of info about the compiler, then you&#8217;re good to go.</p>
<p>Next, we&#8217;re ready to create a simple program to demonstrate how to author Flash content using only Actionscript. Open up your favorite text editor (my preference is <a title="TextMate" href="http://www.macromates.com">TextMate</a>) and create a file called &#8216;HelloWorld.as&#8217;, and slap this code into it:</p>
<pre class="brush:js">
package
{
	import flash.display.Sprite;
	import flash.text.TextField;

	public class HelloWorld extends Sprite
	{
		public function HelloWorld():void
		{
		// Create a new variable to hold a "TextField" and assign an instance of the TextField class to it
		var myMessage:TextField = new TextField();

		// Add some text to the TextField object
		myMessage.text = "Hello World!";

		// Add the text to the main display container
		addChild(myMessage);
		}
	}
}
</pre>
<p>Save your file, then compile it by typing &#8216;mxmlc HelloWorld.as&#8217;. If you see any errors, make sure you copy/pasted the above code exactly. The compiler should output a SWF binary file called &#8216;HelloWorld.swf&#8217;. Double-click it or drag it to your browser to start your new program, and you should see a window with the text &#8220;Hello World&#8221; displayed in the upper left corner. Congratulations! You&#8217;ve successfully set up a development environment, and are now ready to start learning Actionscript and making your own programs.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2009/02/how-to-create-flash-programs-with-actionscript-3-and-the-flex-sdk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>More progress</title>
		<link>http://nathandemick.com/2008/12/more-progress/</link>
		<comments>http://nathandemick.com/2008/12/more-progress/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 13:40:08 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[games]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=166</guid>
		<description><![CDATA[What with Thanksgiving and having to teach my Bible study last week, I haven&#8217;t had a whole lot of time for programming recently. Couple that with the fact that I&#8217;m psuedo-sick again, and it&#8217;s hard times for Actionscript. I needed some inspiration this past weekend, which I got in the form of browsing around some [...]]]></description>
			<content:encoded><![CDATA[<p>What with Thanksgiving and having to teach my Bible study last week, I haven&#8217;t had a whole lot of time for programming recently. Couple that with the fact that I&#8217;m psuedo-sick again, and it&#8217;s hard times for Actionscript. I needed some inspiration this past weekend, which I got in the form of browsing around some <a title="Ifinite Ammo" href="http://www.infiniteammo.ca">stuff</a> the indie community is doing. Also, by firing up my <a title="Aquaria" href="http://www.bit-blot.com/aquaria/">Aquaria</a> demo (which I never finished).</p>
<p>Anyway, check out the <a href="http://www.bitter-gamer.com/files/Game-120708.swf">most recent build</a>. I got some simple &#8220;alien&#8221; type guys moving around in there, and am experimenting with a background. I&#8217;d like to try making the background move in relation to the ship, but I&#8217;m not sure how the effect will turn out. Guess we&#8217;ll see!</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2008/12/more-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vector vs. bitmap graphics in Flash</title>
		<link>http://nathandemick.com/2008/11/vector-vs-bitmap-graphics-in-flash/</link>
		<comments>http://nathandemick.com/2008/11/vector-vs-bitmap-graphics-in-flash/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 13:52:10 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[vector graphics]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=162</guid>
		<description><![CDATA[So, although Flash/Actionscript has super easy ways to scale and rotate a graphical object, when I loaded up a PNG for my spaceship and tried rotating it, it looked pretty ugly. Of course, I didn&#8217;t expect OpenGL-quality scaling and rotation, but I was surprised at how bad it looked. I soon learned that while you [...]]]></description>
			<content:encoded><![CDATA[<p>So, although Flash/Actionscript has super easy ways to scale and rotate a graphical object, when I loaded up a PNG for my spaceship and tried rotating it, it looked pretty ugly. Of course, I didn&#8217;t expect OpenGL-quality scaling and rotation, but I was surprised at how bad it looked. I soon learned that while you can easily import bitmap graphics into Flash (i.e. GIF, JPG, PNG) they don&#8217;t keep their quality if you scale or rotate them. In order to do that, you need to use vector graphics. The gist of vector vs. bitmap graphics is that bitmaps are based on pixels, which do not scale very well, while vector graphics are based on mathematical equations that can be scaled based on screen/size requirements.</p>
<p>One benefit of the Flash IDE is that you can easily create vector graphics and use them in your movie/program. In my initial research, it wasn&#8217;t immediately apparent if you could create vector graphics in another program and then import to Flash. Of course, you can do it with Adobe Illustrator, but how about some other (free) program? </p>
<p>Turns out that you can. <a href="http://www.inkscape.org/" title="Inkscape">Inkscape</a> is a free vector graphics editor, which can output SVG file format images that can be directly imported via Actionscript into your Flash program. Pretty great! One of my goals for today is to learn the basics of a vector graphics editor&#8230; I&#8217;m fairly familiar with programs like Photoship/GIMP, but Inkscape seems to have some different paradigms that I&#8217;ll have to pick up.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2008/11/vector-vs-bitmap-graphics-in-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

