How start with haxe(like AS3) for html/js

Hello everyone, for the moment, with OpenFl, I can’t do anything. I’m just trying to write code and display something in the browser. My only goal with OpenFL is to be able to replace Flash. I am very used to AS3 logic and its Framework. Also, I love FlashDevelop for its intellisence (which Haxe also does). In the long term, I hope to one day be able to compile in webassembly.
All that to say, if anyone knows of a tutorial that really works to do what I’m looking for … it would be cool to tell me a link …
sorry for my English

Here is a simple setup guide:
Choose for ex. option 2.
What exactly doesn’t work?

Good evening @CrazyFlasher, I reinstalled everything to windows, and the command line test works fine! Thank you for your response, I will continue with the launch of the Openfl site and Haxe. Hopefully it works this time: D (I think I had to install the NPN version because it was noted ActionScript and ES6 :rouler des yeux:)

Whith Haxe, output param is HTML5, Plateform is Lime, my code is:


import openfl.display.Bitmap;
import openfl.display.Sprite;
import openfl.Assets;

class Main extends Sprite {

public function new () {

    super ();

    var bitmapData = Assets.getBitmapData ("assets/openfl.png");
    var bitmap = new Bitmap (bitmapData);
    addChild (bitmap);

    bitmap.x = (stage.stageWidth - bitmap.width) / 2;
    bitmap.y = (stage.stageHeight - bitmap.height) / 2;



And résult is an Full Black Screen in Chrome Browser.

With command line:
compil for neko work fine ! but for HTML no ! i have error “unknow target”.

My commands in CMD is:

C:\Users\alama>openfl create DisplayingABitmap

C:\Users\alama>cd DisplayingABitmap

C:\Users\alama\DisplayingABitmap>openfl test neko /work fine/

C:\Users\alama\DisplayingABitmap>openfl test html /* dont work!!"
Error: “html” is an unknown target


I don’t know why… i well followed instructions on the site here:

openfl test html5
Add 5 :slight_smile:

Thanks and sorry but…

C:\Users\alama\DisplayingABitmap>C:\Users\alama\DisplayingABitmap>openfl test html5
‘C:\Users\alama\DisplayingABitmap’ n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.


Why not HTML5 ?? there is not something more to install? I have a good Lime, I just tested it and I have the logo

If you type ‘openfl’ to command line, does it work? Just follow instructions and it should work

Openfl work fine, i have the logo in ascii and Lime too and haxe too All seems work fine, Test Flash work fine too! just HTML5 Dont work, and i don’t understand why, but i search

I folow this tuto step by step :wink:

You typed C:\Users\alama\DisplayingABitmap as the command, while it should just be the working directory
When you are in the correct directory, just type openfl test html5

yes, however from the same path, neko and flash worked, it’s openfl which is placed in my user all alone. Isn’t my working directory the one where all the files in my project are?

I don’r see HTML5 target in Haxe, it’s normal?
–js compile code to JavaScript file
–lua compile code to Lua file
–swf compile code to Flash SWF file
–as3 generate AS3 code into target directory
–neko compile code to Neko Binary
–php generate PHP code into target directory
–cpp generate C++ code into target directory
–cppia generate Cppia code into target file
–cs generate C# code into target directory
–java generate Java code into target directory
–python generate Python code as target file
–hl compile HL code as target file
–interp interpret the program using internal macro system

I don’t understand anything anymore, I haven’t changed anything, I type the same command and this time, it worked !!!

C:\Users\alama\DisplayingABitmap>openfl test html5

Curious to see from haxe …
Under haxe, dont work… should not dream… ok, i continue tomorow… guys, thanks for your help. good end of evening :wink:

As mentionned before, this time you didn’t write the path twice, so that’s why it worked :slight_smile:
OK : C:\Users\alama\DisplayingABitmap>openfl test html5
KO : C:\Users\alama\DisplayingABitmap>C:\Users\alama\DisplayingABitmap>openfl test html5

Regarding haXe targets, html5 is a special target handled only by Lime/OpenFL. (js will be the underlying target in this case)

I see that you are using FlashDevelop as your IDE, do you know you can keep using it to code with haXe/Lime/OpenFL ?
In FlashDevelop, just do :

  • Project menu > New Project
  • Select Lime Project and fill information
  • Paste your code in the src folder
  • Put your assets in the assets folder
  • Run :slight_smile:

Hi @tour1st, yes i know, HaxeDevelop is same as FlashDevelop…

Today, All work, under command line and with project charged in HaxeDev … :smiley:
i keep exploring …
One more question, can we say today that the OpenFL API is equivalent to that of AS3? can the OPFL framework replace 100% that of AS3?

And, Thanks more! :smiling_face_with_three_hearts:

I’d say OpenFL covers ~95% of the complete Flash API, but it really depends on your usage :slight_smile:

1 Like

You can definitely replace flash with openFL. In my case just about everything I used to do in AS3 translated well to openFL. The best part is being able to compile to the different targets with very little modification to each target. Keep at it, practice makes perfect and have fun with it. The more you code with it the easier it gets. I have found that you can even follow the AS3 tutorials on adobe’s site with openFL with simple replacements to the library imports.

1 Like

@Frank_Hernandez, thank for your information :wink:
@tour1st, thank too :smiley: And i yes, i have make a mistake with my double path… lol