Haxe articles updated for Haxe 2.0

11.02.2008 3229 0


The flash API is stronger typed, we can't use Strings instead of flash constants like here :

tfx.align = "center"; -> tfx.align = flash.text.TextFormatAlign.CENTER;

Local variables must be initialized before using them, even if it's null :

var previousIcon : DockIcon; -> var previousIcon : DockIcon = null;

The SWHX Api has changed a bit too.
A context must be created in order to exchange datas.
Remoting server is missing now, it's handled transparently.

var server = new neko.net.RemotingServer();
var flash = new swhx.Flash( window, server);
var context = new haxe.remoting.Context();
context.addObject( "App", App );
flash = new swhx.Flash( window, context );

flash.onSourceLoaded is missing too. Your Flash application have to fire an event to the server side when initialized.

Here you can download the entire article with the source code that works with Haxe 2.0.
The original article issue can be found here : http://www.ffdmag.com/prt/view/about-the-mag/issue/831.html


With Haxe 2.0 the conditionnal compilation directives have changed a bit.
Instead of :

#if xilib
#else !xilib

We have to write :

#if xilib

Here you can get the Xilib example working with Haxe2.0
You can see here the original 2nd issue of FFD magazine : http://www.ffdmag.com/prt/view/about-the-mag/issue/890.html
Don't hesitate to write me if something is going wrong or for more information .


Write a comment