| 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 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"; } } } |
| Arquivo: compile.hxml |
-swf9 button_etude.swf # set swf version to 9 # set dimensions of 700 wide x 400 tall # identify library.swf as my library file # identify main method in ButtonEtude class |
| 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); } } |