Article

haXe: installation and creation of your first Flash application with haXe compiler

haXe is universal high level programming language and its free compiler. haXe lets you create applications fir such platforms as JavaScript, Flash Player 6-8, Flash Player 9 (ActionScript 3) and Neko. Author of this technology is Nicolas Cannasse, the creator of the fastest flash compiler MTASC (now you’ve got a feeling about quality of haXe). Learn more about haXe.

To install haXe compiler (for Windows users):

  1. Go to haXe download page and download installation file.
  2. Unpack. Start haxesetup.exe. Installation goes on in best guerrilla tradition, without unnecessary buzz. One second — and you see the message about succesful installation.
  3. Reboot your machine (to enable PATH variables, added at the previous step).

To create your first Flash application using haXe compiler:

  1. Create test class file ‘Text.hx’ containing the following code (haXe source files have ‘*.hx’ extension):
    class Test {
        static function main() {
            trace("Hello World !");
        }
    }
  2. Create compile.hxml file (’*.hxml’ files are used to tell compilation directives to haXe compiler) with the following code:
    -swf test.swf
    -main Test
  3. Double-click compile.hxml file to open it.
  4. Compiled ‘test.swf’ file will appear in the same folder. You can open it to see the result!

???? embed compiled swf file into web page, use standard html code for embedding flash files (test.html file):

<html>
<head><title>haXe Flash</title></head>
<body bgcolor=”#dddddd”>
<object classid=”clsid:d27cdb6e-ae6d-11cf-96b8-444553540000″
width=”400″
height=”300″
id=”haxe”
align=”middle”>
<param name=”movie” value=”test.swf”/>
<param name=”allowScriptAccess” value=”always” />
<param name=”quality” value=”high” />
<param name=”scale” value=”noscale” />
<param name=”salign” value=”lt” />
<param name=”bgcolor” value=”#ffffff”/>
<embed src=”test.swf”
bgcolor=”#ffffff”
width=”400″
height=”300″
name=”haxe”
quality=”high”
align=”middle”
allowScriptAccess=”always”
type=”application/x-shockwave-flash”
pluginspage=”http://www.macromedia.com/go/getflashplayer”
/>
</object>
</body>
</html>

Have good day with haXe!

These instructions is the compilation of the haXe Usage, haXe downloads and Getting Started with haXe/Flash pages.

For further studying and using haXe visit the last link and other haXe tutorials, for example, haXe for Flash9 as replacement of ActionScript 3.

Something is not clear? Don’t hesitate to ask here or in the haXe mailing list.

Comments (No comments)

There are no comments for this post so far.

Post a comment

Best entries: RoR Caingorm Generator, XPath for haXe, haXe FLV, PV3D wiki, Benny the Brave, ++++++ , Flash CS3 Illustrator import, Adobe SOC, JSAPI feature, Apollo 3D Test, Skins for Flex / AIR, DVD Rippers, Name Japaneser, 7+ , White hat SEO for Flash Platform, Google 3D Maps v 0.4, Firefox search plugins, HD TV and MPEG-4 in FP9, Flex VoIP, Kongregate , 8+ , Comments gathering, 3D Alternativa Game, Global function in as3, CS3 Master, Away3D, FB for Linux, DoFollow, 9+ , Bruce Eckel on Flex , Bee desktop blog editor , Saffron UML Tool, Aptana IDE with AIR, Flv Player 2.0, MKSS.EXE troubles, Flickr loves Flash, RIA battles, Top Evangelists, Amazing 3D, 0+ , Alternativa Game in 2008, RAFPUG-2, Flex 3 Skin Issue, IntelliJ IDEA for Flex, Polar Distortion in AS3.