<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>assertTrue: HaXe Sample Application :: Simple Slide Show</title>
    <link>http://www.asserttrue.com/articles/2006/08/21/haxe-sample-application-simple-slide-show</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>powered by Pattern Park</description>
    <item>
      <title>HaXe Sample Application :: Simple Slide Show</title>
      <description>&lt;p&gt;If you&amp;#8217;ve been reading this blog then it should be clear to you that I&amp;#8217;m pretty interested in the &lt;a href="http://www.haxe.org"&gt;haXe&lt;/a&gt; programming language (if it&amp;#8217;s not clear see: &lt;a href="http://www.asserttrue.com/articles/2006/07/25/invest-regulary-in-your-knowledge-portfolio"&gt;Invest Regulary in Your Knowledge Portfolio&lt;/a&gt;, &lt;a href="http://www.asserttrue.com/articles/2006/08/02/wheres-haxe"&gt;Where&amp;#8217;s haXe?&lt;/a&gt;, &lt;a href="http://www.asserttrue.com/articles/2006/08/07/haxe-found"&gt;HaXe Found!&lt;/a&gt;, and &lt;a href="http://www.asserttrue.com/articles/2006/08/17/haxe-1-05-with-flash-player-9-support"&gt;HaXe 1.05 Supports Flash Player 9!&lt;/a&gt;).    My interest in &lt;a href="http://www.haxe.org/intro"&gt;haXe&lt;/a&gt; is rooted in my desire to build &lt;a href="http://www.asserttrue.com/articles/2006/08/02/flash-player-7-universally-available"&gt;universally available&lt;/a&gt; applications with a code-base that I can grow.&lt;/p&gt;


	&lt;p&gt;To learn the haXe syntax and language APIs, I wrote a &lt;a href="http://www.asserttrue.com/files/Mediator.zip"&gt;Simple Slide Show&lt;/a&gt; application that I call &lt;a href="http://www.asserttrue.com/files/Mediator.zip"&gt;Mediator&lt;/a&gt;.  Here it is:&lt;/p&gt;


&lt;center&gt;
&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="450" height="450" id="info" align="middle"&gt;
&lt;param name="allowScriptAccess" value="sameDomain" /&gt;
&lt;param name="movie" value="/files/Mediator.swf" /&gt;
&lt;param name="quality" value="high" /&gt;
&lt;param name="bgcolor" value="#cccccc" /&gt;
&lt;embed src="/files/Mediator.swf" quality="high" bgcolor="#cccccc" width="450" height="450" name="info" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /&gt;
&lt;/object&gt;
&lt;/center&gt;

	&lt;p&gt;You can download the source &lt;a href="http://www.asserttrue.com/files/Mediator.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;


Some interesting parts of &lt;a href="http://www.asserttrue.com/files/Mediator.zip"&gt;Mediator&lt;/a&gt; follow:
	&lt;ul&gt;
	&lt;li&gt;the &lt;a href="http://www.asserttrue.com/articles/2006/08/02/wheres-haxe"&gt;&lt;strong&gt;EventDispatcher&lt;/strong&gt;&lt;/a&gt; class demonstrates many elements of the haXe syntax&lt;/li&gt;
		&lt;li&gt;background art is externalized in the &lt;span class="caps"&gt;FLA&lt;/span&gt; &lt;em&gt;art/MediatorAssets.fla&lt;/em&gt;&lt;/li&gt;
		&lt;li&gt;slide data is externalized in the &lt;span class="caps"&gt;XML&lt;/span&gt; document &lt;em&gt;xml/Mediator.xml&lt;/em&gt;&lt;/li&gt;
		&lt;li&gt;the &lt;strong&gt;MediatorModel&lt;/strong&gt; class demonstrates &lt;span class="caps"&gt;XML&lt;/span&gt; parsing in haXe&lt;/li&gt;
		&lt;li&gt;the entire application has a flexible layout (which you won&amp;#8217;t be able to notice unless you &lt;a href="http://www.asserttrue.com/files/Mediator.zip"&gt;download Mediator.zip&lt;/a&gt;, run the &lt;em&gt;Mediator.swf&lt;/em&gt; on your desktop, and resize it)&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;Event&lt;/strong&gt;s in the application bubble, this is handled by the &lt;strong&gt;Component&lt;/strong&gt; class&amp;#8217;s &lt;em&gt;dispatchEvent()&lt;/em&gt; method; that method looks like:&lt;/li&gt;
	&lt;/ul&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;    public function dispatchEvent(event:Event):Bool {
        var dispatched:Bool = dispatcher.dispatchEvent(event);
        if(event.bubbles &amp;amp;&amp;amp; dispatched &amp;amp;&amp;amp; getParent() != null) {
            getParent().dispatchEvent(event);
        }
        return dispatched;
    }&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;To compile the simple slide show, first &lt;a href="http://www.haxe.org/download"&gt;download and install haXe&lt;/a&gt;, then &lt;a href="http://www.asserttrue.com/files/Mediator.zip"&gt;download Mediator.zip&lt;/a&gt;, and after unpacking it double-click &lt;em&gt;build.hxml&lt;/em&gt;.&lt;/p&gt;


	&lt;p&gt;To run the application locally without compiling, just double-click &lt;em&gt;Mediator.swf&lt;/em&gt;.&lt;/p&gt;</description>
      <pubDate>Mon, 21 Aug 2006 22:15:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:1828bc36-4551-4e87-a21d-b8466fccf3d8</guid>
      <author>Ali Mills</author>
      <link>http://www.asserttrue.com/articles/2006/08/21/haxe-sample-application-simple-slide-show</link>
      <category>alimills</category>
      <category>haxe</category>
      <trackback:ping>http://www.asserttrue.com/articles/trackback/52</trackback:ping>
    </item>
  </channel>
</rss>
