NME 3: Flash, C++ and now HTML5

From the beginning, Haxe was created to be a “multi-platform programming language.”

NME relies on Haxe for reliable compilation to Flash and C++, but these aren’t the only languages Haxe supports. Meanwhile, a project (you may have heard of) called Jeash used Haxe to mirror the Flash API… but for Javascript.

For everyone who is excited by HTML5, you can now publish to Flash, C++ and Canvas as easy as…

haxelib run nme test MyProject.nmml flash
haxelib run nme test MyProject.nmml ios -simulator
haxelib run nme test MyProject.nmml webos
haxelib run nme test MyProject.nmml android
haxelib run nme test MyProject.nmml cpp
haxelib run nme test MyProject.nmml cpp -64
haxelib run nme test MyProject.nmml html5

Here is my previous “Actuate Example,” running in Flash and in Canvas as a comparison:

http://www.joshuagranick.com/examples/actuate/circles/flash/
http://www.joshuagranick.com/examples/actuate/circles/canvas/

  • Nice work! Is this available in haxelib now? Or only on SVN?

  • Dr. Green

    NME is “haxelibed”. (haxelib install nme)

  • These features are currently on the repository, but I think we’re nearing a new release on haxelib

  • Максим Фуртуна

    Hi. Do you plan to add support for canvas emulation on html 4 and old browsers(IE6-8) ? And not to use opengl as a way for rendering(but only if developer needs it) ? It allows developping a gui interface for both: desktop and web, without additional requirements.

    For canvas emulation also presents the js lib from google. 

    P.S.: Think that you can merge nme and jeash in one project because it “based on one base” since jeash was started from neash.

  • I’ve gone down the road of canvas emulation, and it caused me no end of headaches. Fortunately, since you can publish *directly* to Flash, rather than having Javascript interpreted by a canvas emulator, I would imagine that using Flash would be the best way to fallback for these browsers. What do you think?

  • Максим Фуртуна

    Think that flash doesn’t support right mouse button click(for context menu) and some other features. Ajax way is more preffered for services and utils like db management, administrative interface and others… But only as the fallback way it can be used.

  • If someone is able to take a generated Jeash project, and modify the HTML so that it runs with a canvas emulator instead, then I might be able to write it up so that you could add a “-fakecanvas” tag, or something to that spirit, to generate the alternate template.

    In my experience (trying to find an emulator for three.js), I couldn’t find anything that was up to snuff, unfortunately

  • Максим Фуртуна

    I think that it is possible to implement native javascript support in nme using nme c++ base algorithms. In weekend i will try it on my local svn source.

  • Максим Фуртуна

    I analyzed the code and concluded that jeash and nme became too different (although they are based on neash): too much attachments and differences between platforms and interfaces are poorly documented. So in looking for is jeash the most convenient way. Maybe when hxcpp will be “from the box” to support all platforms and will support raw dll’s as well as their creation (for example like extern will be added export), it becomes more easy and affordable task.

    At the moment I am busy developing cross-platform gui library and nme regarded as one of the options, but because of strong differences between platforms nme applies only to no js platforms.

    P.S.: Sorry for bad english, i’ve only started to learn them.

  • If you create a GUI library that accesses higher level functions for fills and bitmaps, you are going to be safe on all platforms.

    If you want to go native, so HTML and Javascript, or C++, or Flash, you are going to have differences for each target, by virtue of the lower level language and rendering method being different.

    Personally, I would go with the higher level API and make that work. Or, you can always consider what targets matter the most to you. Canvas and Flash, or Neko and C++, may be redundant for you, so target what you need.

    Lastly, its entirely possible to avoid the Flash API. Create your own thing. Or create a variation of Jeash that uses DIVs instead of Canvas. Part of my goals are to provide an atmosphere where others can play, hack, improve or innovate on what already exists. If someone comes up with “Jeash 2” it could be supported.

    The purpose of the project is to follow the Flash API, however there is nothing to stop you from using NME as a base foundation, upon which you leverage a different library that handles rendering with an entirely different API.

    I have found Flash and C++ to be very similar in functionality. I have only begun to use the current version of Jeash, but I personally have been surprised how much “just works”

  • Максим Фуртуна

    I found a way to use canvas on old browsers without patching jeash. The methodique use:

    var oldDCE=document.createElement;
    document.createElement=function(tagName){
    if(el.toUpper()==’CANVAS’)
    return new MyCanvasEmulator();
    return oldDCE.call(this,tagName);
    }
    + patch of
    http://code.google.com/p/explorercanvas/
    It is very simple to do this, but i have no much time for this.

  • Максим Фуртуна

    There is not only a problem with canvas supporting by browser but also with jeash because jeash use specific atributes(non standart) for doing canvas transformations. Need more time. Patch will be available later.