Exemplo 1

Exemplo 1: compile.hxml
# haxe compile.hxml
-swf test.swf
-main Test
-swf-header 200:300:30:FFFFFF
-swf-version 9
Exemplo 1: Test.hx
// haxe compile.hxml

import flash.display.Sprite;
import flash.events.KeyboardEvent;
import pkg.System;
class Test extends Sprite{

   static function main() {
      var foo = new System();

      foo.Write("Oi");

      foo.ReadLine();

   }

   function init() {
      stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPress);
   }

  function onKeyPress(e : KeyboardEvent) {
      trace("Key Code: " + e.keyCode);
  }

}

Exemplo 2

Exemplo 1: compile.hxml
# haxe compile.hxml
-swf teste.swf
-main teste
-swf-header 200:300:30:FFFFFF
-swf-version 9
Exemplo 2: teste.hx
class teste {
   static function main() {

      var texto:TextArea = new TextArea();
      texto.text = "";
      texto.setSize(200, 100);
      texto.move(10, 10);
      addChild(texto);

      var botao:Button = new Button();
      botao.label = "Clique Aqui!";
      botao.setSize(200, 25);
      botao.move(10, 100+25);
      botao.addEventListener(MouseEvent.CLICK, onClick);
      addChild(botao);

      function onClick(evt:MouseEvent):void {
          texto.text = "Esta é a nova mensagem";
      }
   }
}

Importando uma LIB <= *.swf

Arquivo: compile.hxml

-swf9 button_etude.swf

# set swf version to 9
# don't know if that's necessary given the above swf9 switch
-swf-version 9

# set dimensions of 700 wide x 400 tall
# 40 frames per second
# background color of #FFFFFF
-swf-header 700:400:40:FFFFFF

# identify library.swf as my library file
-swf-lib library.swf

# identify main method in ButtonEtude class
# which lives in ButtonEtude.hx
-main ButtonEtude

Arquivo: ButtonEtude.hx
import flash.display.MovieClip;

class ButtonEtude
{
    private static var _button_factory : ArrowButtonFactory;

    public static function main()
    {  
        ButtonEtude._button_factory = new ArrowButtonFactory();

        var target_box : MovieClip = ButtonEtude._makeTargetBox();

        /* labels go under clickable things */
        ButtonEtude._makeLabels();

        /* initialize button events with target and make the buttons */
        var button_events : ButtonEvents = ButtonEvents.getInstance(target_box);
        ButtonEtude._makeButtons(button_events);
    }
}