An IDE for HAXE and NME for every OS

The long wait is over! The search for a perfect IDE for Haxe and NME is finally over. Thanks to the hard work of Joshua Granick. He is still in development of this feature, but for me I found it perfectly alright to use it in my Mac OSX.
So the IDE is Mono Develop and making it a Haxe and NME IDE is just enabling the addin for it. Presently its a manual process but thats ok I think. The Addin is on the github.
Everything is just straight forward. Just a little thing on command line is to create a .hxml file in OSX. I am not sure if thats the case in other OSs. Navigate to your newly created project folder from Terminal and fire up the command below (where {projectName} should be replaced with your own project name)

haxelib run nme display {projectName}.nmml mac>{projectName}.hxml

Thats all to it. Just open up MonoDevelop and enjoy code hilight, code hinting and compilation from inside the IDE.

Happy haXe -ing

RayTrace v3.0.0

A new release of RayTrace, the simplest flash logger. Its made with haXe and compiled with NME for SWF output.

The feature list is as below
1. Stop and start button (To start the logger and stop the logger)
2. A sightly improved GUI (some colors at last)

With that here is the link to the compiled code (SWF and the lib for directly use in your project) and here is the github source code.

Happy haXe -ing

haXe : raytrace v2.0.0

This started of as my own little utility but then I use it in almost all the flash, flex, haXe applications when output is SWF. Now its available as a opensource project in github and the final compile dfiles are here, if you just want to use it.
This is nothing more than a logger named raytrace. It takes string as the only parameter and the implementation is done in haXe and NME.
Just put the “raytrace.as” in the root folder of your flash/flex application and then from anywhere in your code one can write

raytrace('my message');

Then this message will be visible in this RayTrace swf. Both the “.as” file and the “.swf” are packaged here as a zip file for your no time getting started.

Happy haXe -ing

RayTrace : An external logger for flash

Well, with my moving forward with haXe and NME, I needed an external logger for flash targets. Though there is a trace message view by default in haXe, it is necessary to have an external logger for me. RayTrace is written in haXe and can be used in any flash and flex based applications not only written in haXe. So if you are doing a pur actionscript or flex project, still you can use RayTrace as your logger. It comes with a client class for flash based projects, which is written in actionscript. Just put the file in the root directory and you are good to go. From anywhere in your actionscript code do a raytrace as below.

raytrace('my message');

The message you send from your code will be visible in the RayTrace logger. Currently it simply supports the string message only.

The source code is available in github as well so as if you want can go ahead and write your own implementation.

happy haXe -ing

NME 3.2 is released

This seems to be one of the most active projects. The last beta release and this final release of NME 3.2 is a proof of that.
Well with this release it is now confirmed that NME supports SWF assets to publish to SWF and C++ targets. This is just one of the many advantages one get while using NME.

The new project file improvements are noted here.
Again I am putting the same here for a quick reference.
















Happy haXe -ing

haXe : Conditional compiling

A nice and exciting feature about haXe is conditional compilation. That means one can specify which code to compile depending upon the target chosen at the compile time. Hah, that does not make sense ? Ya, I know. Let me explain again.
There is a compiler and while providing argument to it we have to specify which target we are compiling to. Like in case of haXe and NME we can compile it to a lot of different targets. The compiler argument for flash or swf output looks as below

haxelib run nme test app.nmml flash

Now we can compile the code to HTML5 with the following argument

haxelib run nme test app.nmml html5

Thats the beauty of the language. Most of the time its the same code, but then there are times when we need to write different codes for different targets (may be layout, view elements, can be anything). But then one does not need to keep a separate project for all the different cases. The solution is conditional compiling. What it does is depending upon the target type specified to compiler, it picks up the right code from the same file. Whoaa!! Magic :)
How does it do it or how we make it aware of this ?! You asked it. Lets see it.

#if flash
//Code for SWF output
#elseif js
//Code for HTML5/js output
#else
#end

Thats simple. Its one file, completely in itself, but when it comes to compiler it picks up the right code part depending upon the target type.

One thing to remember though, that when specifying HTML5 target, it picks up conditions from “js”, it does not have a “html5″ option. This particular thing took me sometime to figure out. Just thought would point out here saving someone’s time out there.

Happy haxe -ing :)

NME 3.2 Beta is here

This is another exciting release of NME. And with this comes the support of SWF directly. Though its only for creating SWF and C++ targets but thats huge (Windows, Mac, Linux, Android, iOS, webOS), only thing not present is HTML5.

Now I am waiting to get my hands dirty with the new version.

The official blog entry.
A tutorial for the SWF support.

Happy haXe -ing :)

haXe : doing a regular update and NME

This came to me as a surprise while trying to write a script, which can run in iOS, HTML5, Flash and Neko. I knew it can be done by cross-compiling through NME to all these target platforms. While this hold good almost in every case but when it comes to regular stage update or the ENTER_FRAME event, it is a problem.
Well, if you are a flash developer and depend on ENTER_FRAME event for a long time, then it may come to you as a surprise like me. The game loop as the gaming engines call it, now has to be worked upon. Fortunately we have a timer function in haXe and that quite fits the game.
Before going ahead in timer, lets see the unreliable nature of ENTER_FRAME for all targets. Firstly I was creating different circles in stage area with an ENTER_FRAME, while that worked well in all platforms, I thought its good to go for all. But then I tried to rely upon the same ENTER_FRAME event with a drag and drop and position change of the elements. Whoa!! That does not work! I stopped relying on the ENTER_FRAME event and changed that with Timer and everything is back in the action again.
The haXe timer code is a little different than Flash timer and the code looks as below.

var timer = new Timer(10); //10 is the time difference in milliseconds between the timer call
timer.run = onEachTimerTick;//its kind of event listener
function onEachTimerTick():Void {}

For me, ENTER_FRAME event only worked for Flash targets and nothing else. So be careful if you want to target other delivery methods.

Happy coding!