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 :)