<?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>Game Haxe &#187; preloader</title>
	<atom:link href="http://gamehaxe.com/tag/preloader/feed/" rel="self" type="application/rss+xml" />
	<link>http://gamehaxe.com</link>
	<description>Experimenting with Web Game Development</description>
	<lastBuildDate>Fri, 17 Jun 2011 01:24:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Haxe Preloader For Flash &#8211; Written in Haxe.</title>
		<link>http://gamehaxe.com/2009/02/04/haxe-preloader-for-flash-written-in-haxe/</link>
		<comments>http://gamehaxe.com/2009/02/04/haxe-preloader-for-flash-written-in-haxe/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 16:08:49 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[neko]]></category>
		<category><![CDATA[Souce]]></category>
		<category><![CDATA[Haxe]]></category>
		<category><![CDATA[preloader]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=108</guid>
		<description><![CDATA[There has been some talk about creating flash preloaders for haxe. However, these methods step outside the haxe toolchain and add some additional complication. I have come up with a reasonably simple method for creating a haxe preloader in haxe, &#8230; <a href="http://gamehaxe.com/2009/02/04/haxe-preloader-for-flash-written-in-haxe/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There has been <a href="http://www.mindless-labs.com/blog/archive/2009/01/09/True_one-file_Haxe_preloader_u">some talk</a> about creating flash preloaders for haxe.  However, these methods step outside the haxe toolchain and add some additional complication.</p>
<p>I have come up with a reasonably simple method for creating a haxe preloader in haxe, and then linking to a (very almost) unmodified swf generated in haxe using a small neko program to produce a single file.  The neko program uses code from the hxformat project, some of which is provided so you can easily recompile the tool.</p>
<p><a href="http://gamehaxe.com/wp-content/uploads/2009/02/output.swf">Output.swf</a></p>
<p>Since each original haxe swf contains one frame, the resulting code<br />
contains 2 frames.  The first frame contains the preloader<br />
which waits for the whole file to load and then locates the<br />
PreloaderBoot class by name.  This class runs the appropriate<br />
initialisation code, creating and running the correct &#8220;main&#8221; class.</p>
<p>For classes that appear in both preloader and the main swf,<br />
flash takes the first one &#8211; the one form the preloader.  This means<br />
that both classes will have the same &#8220;flash.Lib.current&#8221; and<br />
(almost) everything will just work.</p>
<p>One complication comes from the fact that the flash.Boot class<br />
is given a unique name for each of the swfs.  This means flash.Boot<br />
class in the main swf is not automatically &#8220;new&#8221;ed and placed<br />
on the stage, and the standard haxe initialisation code is not<br />
run.  To compensate, we manually set the trace function and<br />
call the Boot initialisation code explicitly.</p>
<p>This sounds a little dodgy to me, but it seems to work &#8211; I will<br />
have to do some more testing.</p>
<p>The &#8220;Main&#8221; class in the example zip contains a resource to pad it out.  The preloaded swf can be seen <a href='http://gamehaxe.com/wp-content/uploads/2009/02/output.swf'>on it&#8217;s own screen</a>.  You can refresh to see it loading.</p>
<p>The example code is in<br />
<a href="http://gamehaxe.com/wp-content/uploads/2009/02/haxe-preloader-0.zip">haxe-preloader-0.1.zip</a></p>
<p>All code &#038; data there is public domain, except for the hxformat code,<br />
which has its own license.  Use at your own risk.</p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2009/02/04/haxe-preloader-for-flash-written-in-haxe/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

