2012.06.10Using starling and haxe

  • Dowload Starling
  • unzip the archive

  • unzip ./starling/bin/starling.swc

  • copy the obtained library.swf file somewhere in your project (renaming it starling.swf might be a good idea).

  • create a path file named 'starling.patch' (http://haxe.org/manual/swc):


  • Now the little test:

    // Test.hx
    import starling.core.Starling;
    import starling.display.Sprite;
    import starling.text.TextField;
    class Test extends Sprite {
        public function new(){
            var textField = new TextField(400, 300, "Welcome to Starling!");
        public static function main(){
            var s = new Starling(Test, flash.Lib.current.stage);

  • And the compilation instructions:

    haxe \
      -main Test \
      -swf-header 400:300:80:aeaeae \
      -swf Test.swf \
      -swf-version 11.3 \
      -swf-lib starling.swf \
      --macro "patchTypes('starling.patch')"

  • Don't forget to download the latest standalone flash player and debugger, I experienced problems with the version I previously installed.

Test project: haxe-starling.tgz

And now, can a haxelib package add compilation parameters to haxe so the following would automatically add -swf-lib and --macro?

haxelib install starling
haxe -lib starling ...