Skip to content

Debugging

Mark Knol edited this page Jun 25, 2014 · 14 revisions
### 🔴 Breakpoints In FlashDevelop you can add breakpoints by clicking on the left side of a linenumber in the editor and choose 'test project' (blue play-button in top bar). Note that to debug from within FlashDevelop, your browser needs the Flash [debug player].

💻 Writing messages to the console

Haxe provides developers with a powerful trace system. You can simply call trace everywhere within your own functions:

trace("Hello world !");

In FlashDevelop on a flash target, you can read the messages in the output-window and in Javascript it will be written in the browsers console. Each trace is displayed with Filename and Line number informations where the trace occured : Test.hx:11: Hello world !

Debug messages only appear in a debug build. More info: http://haxe.org/doc/cross/trace

Conditional compilation

For debug purposes it could be very useful to use debug conditional compilation tags.

🎱 Display the current framerate

To check if your game still runs in 60 fps, you can use the FpsDisplay, which displays the current framerate. You need a font to display it.

   var font:Font = new Font(pack, "myFont"); 
   var fpsMeterEntity = new Entity().add(new TextSprite(font)).add(new FpsDisplay());
   System.root.addChild(fpsMeterEntity);
Clone this wiki locally