2. HaXe
From haxe.org:
The idea behind haXe is to let the developer choose
the best platform to do a given job. In general, this is
not easy to do because every new platform comes with
its own programming language. What haXe provides to
you is :
● a standardized language with many good features
● a standard library (including Date, Xml, Math...) that
works the same on all platforms
● platform-specific libraries : the full APIs for a given
platform are accessible from haXe
3. Haxe
● Based on ECMA script and thus very
similar to ActionScript 3
● Different targets:
– SWF bytecode (Flash)
– ActionScript code (Flash)
– JavaScript
– PHP
– C++
– NekoVM
4. NekoVM
● Lightweight virtual machine
● Can be used for server side scripting
(mod_neko on Apache)
● Can be used to deploy native applications
on the client side (ScreenweaverHx and
hippoHx)
● Recently gained a experimental LLVM
implementation
5. HaXeLib
● Used to manage additional HaXe libraries
(similar to ruby gems)
● Easy installation of libraries
● Large number of libraries available
– Physics
– 3D Graphics
– MVC frameworks
– GUI frameworks
– Animation/Tweening
7. HaXe wrt. Flash
● Target all the different versions of Flash
(you could target Flash 7/8 and use
Gnash instead of Adobe Flash
Player/Plugin)
● More comparable to Flex rather than the
Flash IDE
● Currently optimizes code better that the
Flash and Flex compilers
● Can control PixelBender
8. The toolchain
● Make
● Swfmill
● FFMPEG
● HaXe compiler
● Flash debug player or browser plugin
9. Make
● GNU Make
● Simple bash-like configuration
● Ex.
all: menu.swf lib external
external: buildExternal
make -C external
menu.swf: src/*.hx resource.swf compile.hxml catalogue.xml
haxe compile.hxml
lib:
make -C lib
resource.swf: resource.swfml resources/samusic/*
swfmill simple resource.swfml resource.swf
clean:
rm -f resource.swf menu.swf resource2.swf menu2.swf *~
10. Swfmill
● Used to embed resources inside SWF files
– Images
– Audio
– Fonts
– Binary
12. FFMPEG
● Used to encode video files to FLV
● Used H.264 codec
● ffmpeg -i filename.extension filename.flv
13. HaXe Compiler
● Use a text configuration file for compilation
● Ex.
-swf menu.swf
-swf-version 9
-swf-lib resource.swf
-resource catalogue.xml@catalogue
-cp src
-cp lib/src
-main Menu
14. HaXe Code
class Background extends flash.display.Sprite {}
class Comic extends flash.text.Font {}
class Menu
{
public var width(default,default) : Float;
public var height(default,none) : Float;
public static function main()
{
flash.Lib.current.addChild(new Background());
}
}