Flash Toony prototype ported to Haxe

It seems Flash Toony prototype is getting quite an interest because some days after the iPhone port made with Corona SDK, it’s the time for Julian Liebl from Nortlight Games to show us the Haxe port of the prototype.

Haxe can be compiled to all popular programming platforms with its fast compiler – JavaScript, Flash, NekoVM, PHP, C++, C# and Java (soon) – which means your apps will support all popular mobile devices, such as iOS, Android, Windows Mobile, webOS and more.

and the result, compiled as SWF, is:

You should know how to play, drag and drop the shapes in the bottom row to match falling shapes.

In the zipped archive Julian shares with us, you can find the complete source code as well as the Flash and Mac App builds.

  • While haXe allows you to compile to multiple target the code above is strictly SWF only isn’t it? Using the ‘flash’ package in your imports means you’re using Flash-specific classes that won’t publish to other targets. You’ll get ‘class not found’ errors when you compile.

    The best solution I’ve found so far to ‘write once, compile for anything’ is NME (http://haxe.nme.org) – If you replaced the ‘flash’ package imports in the class above with ‘nme’ package imports you’ll get something that compiles perfectly to SWF and html5 (and presumably others I didn’t test), but still needs a little work in html5 due to some issues with returning the draggable sprites to their origin when dropped.

    I’m not disparaging haXe, or the cool work done by Emanuel and Julian, but to imply that the code above is cross-platform seems incorrect.

  • Sorry, I mistyped the URL for NME – it should be http://haxenme.org

  • Hi Emanuele,

    Yesterday I decided to try and port your Toony prototype game sample using even fewer changes from the original Actionscript.

    If you’re interested, its posted here:


    Thanks again for all of the samples you’ve shared over the years. Several of your posts were influential for me when I began learning how to use Box2D :)

  • ico

    well there is a bug the blue whent behind the yellow and i cant use it any more

  • Chris,

    Although it’s generally best to use the nme.* package when leveraging NME, Julian’s code is completely valid. Haxe supports a “remap” option which will change packages dynamically at runtime. By default, NME compiles using “–remap flash:nme”, so even if you use the flash.* package, the code compiles properly.

    In my experience, everything works very consistently in Flash and all of NME’s C++ targets. There’s some inconsistency when targeting HTML5 as well, but it can be done, and its getting better over time. I’d call HTML5 support “beta” for now. The Jeash project was only recently merged into NME, officially.

  • Sorry, I didn’t mean at runtime. I meant at compile time. The “remap” option will redirect the root of a package at compile time

  • Hi,

    @Chris: As Joshua already said, the remap feature of nme handles the flash lib “problem”. Normally I would also use nme.* instead of flash.* because you might run into problems ones a package is available for flash but not for nme (rare case). But for porting the remapping of classes is a great time saver.

    @ico: These bugs will happen from time to time. I have the same problem with emanueles prototype. Prototypes are just a prove of concept. We are currently making a toony clone for webOS just for fun. It will be open sourced (just follow my tech blog if you are interested http://diesistmein.name). These bugs will be removed then.

    @Joshua: Glad that you could even do less changes to the code. I wasn’t familiar with the integration of swf files in haxe. I always learn new stuff thanks to you :)

  • Pingback: Flash Toony prototype ported to Haxe – Emanuele Feronato « eaflash()