Questions tagged [haxe]

Haxe can build cross-platform applications targeting JavaScript, C++, C#, Java, JVM, Python, Lua, PHP, Flash, and allows access to each platform's native capabilities. Haxe has its own VMs (HashLink and NekoVM) but can also run in interpreted mode. Code written in Haxe can be compiled to any target Haxe supports.

Haxe is an open source, multiplatform programming language that allows developers to JavaScript, C++, C#, Java, JVM, Python, Lua, PHP, Flash, NekoVM and HashLink using the same syntax.

Haxe includes a set of common functionality that is supported across all platforms, such as numeric data types, text, arrays, binary and some common file formats. Haxe also includes platform-specific APIs. It can be integrated with existing libraries using extern definitions (e.g: JavaScript) or leveraging the compiler to connect directly to native libraries (e.g: .jar for Java and .dll for C#).

Haxe can also compile to bytecode (Neko, HashLink or JVM), which runs in the runtime created by the same developer.

Haxe is a garbage-collected language. Some target platforms do not have a native garbage collector - in those cases Haxe provides its own runtime, like in the case of C++, to take care of GC and other things.

Haxe ships with its own package manager called .

Haxe was developed by Nicolas Cannasse and other contributors and is backed by the Haxe Foundation. It was named Haxe because it was short, simple, and "has an X inside", which the author humorously asserts is necessary to make any new technology a success. Haxe is pronounced "hex" /heks/, although many community members pronounce it "hacks".

Haxe is known for its multitude of game development and multimedia libraries. With frameworks like , or built on top of Haxe, developers can target platforms like:

All from a single code base.

Popular game engines include , , and . The powerful physics engine is written in Haxe as well.

With UI frameworks like and , user interfaces can be created for a wide range of target platforms. With , there is also a feature-rich MVC web framework available. To create reactive web applications using a virtual DOM, coconut.ui can be used, which shares significant similarities with .

1627 questions
14
votes
2 answers

Passing a function as a parameter in Haxe

In the Haxe programming language, is it possible to pass a function as a parameter (like in JavaScript?) For example, is the following code considered valid in Haxe? function a(){ trace("This function is being used as a parameter!"); } function…
Anderson Green
  • 30,230
  • 67
  • 195
  • 328
13
votes
1 answer

What are the pro and cons of using Haxe over Actionscript-3?

I'm thinking about using Haxe in place of AS3. What are the disadventages of that? I can think about: Difficulties with using native AS3 libraries. Difficulity of debugging after language translation. Haxe is quite young, it may have some rough…
Łukasz Lew
  • 48,526
  • 41
  • 139
  • 208
13
votes
2 answers

Meaning of question mark operator '?' before arguments in Haxe

What is the difference between these two function signatures? function f(?i:Int = 0) {} function f(i:Int = 0) {} It doesn't seem to make any difference whether argument is prefixed with ?, both compile fine.
Dlean Jeans
  • 966
  • 1
  • 8
  • 23
12
votes
2 answers

Where is "setTimeout" from JavaScript in Haxe?

Is there an implementation of setTimeout() and clearTimeout() in Haxe? It's of course possible to use the Timer class, but for a one-shot execution it's not the best way, I guess.
nepa
  • 1,421
  • 2
  • 18
  • 28
12
votes
2 answers

Haxe compiled code performance

How does Haxe compiled code compare in performance to its different targets? For example, is PHP coming from Haxe faster or slower than original PHP code? What about Javascript? Flash? C++? Etc. Is there any serious benchmark out there?
Pier
  • 10,298
  • 17
  • 67
  • 113
12
votes
1 answer

Haxe Int to String

It seems AS3 has a toString() for the Number class. Is there an equivalent in Haxe? The only solution I could come up with for converting an Int to a String is a function like: public function IntToString(i:Int):String { var strbuf:StringBuf =…
dunstantom
  • 551
  • 2
  • 5
  • 10
12
votes
3 answers

Haxe & NME: fastest method for per pixel bitmap manipulation

This is a small project for testing pixel level manipulation performance of NME for different builds (Windows c++, Flash). It uses BitmapData.setPixel to modify the pixels one by one (320x240 for every frame). The C++ build runs at 22 FPS, and the…
Kalevi
  • 591
  • 6
  • 14
11
votes
6 answers

actionscript development on mac

I know of FlashDevelop for windows but how about developing actionscript or haxe on a mac? besides flex plugin for eclipse, flex builder and FDT is there anny good IDE out there for actionscript development on mac? I would really like to se a good…
eldamar
  • 659
  • 1
  • 7
  • 19
10
votes
3 answers

Where's the HXML docs?

I've looked all over the Haxe Flash Command-line compiler website but was unable to find any detailed documentation of the HXML files (scroll down to the "Changing SWF properties" section) which describe the compile. Anybody know of a reference…
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
10
votes
2 answers

Constants in Haxe

How do you create public constants in Haxe? I just need the analog of good old const in AS3: public class Hello { public static const HEY:String = "hey"; }
momijigari
  • 1,598
  • 2
  • 14
  • 28
9
votes
1 answer

Access the compilation date during compilation in Haxe

I was wondering whether it is possible to access external information - like the current date during compilation. It would then be possible to do something like this: class MyInfo { private var buildDate:Int = --- AUTOMATICALLY INSERT THE…
quant
  • 2,184
  • 2
  • 19
  • 29
9
votes
2 answers

Would Haxe work for creating libraries?

I was thinking of using Haxe for it's cross-language ability, but wasn't sure if it was the best for this task. I'm going to write a generic library that should be able to be used in the target languages and be documented(able to apply something…
eyecreate
  • 1,017
  • 3
  • 14
  • 26
9
votes
4 answers

Haxe for javascript without global namespace pollution?

This question only applies to Haxe version < 2.10 I've known about haxe for a while, but never really played with it until yesterday. Being curious, I decided to port showdown.js, a javascript port of markdown.pl, to haxe. This was pretty…
Dagg Nabbit
  • 75,346
  • 19
  • 113
  • 141
9
votes
3 answers

Is there a way to declare classes and methods as abstract in Haxe?

Is there a way in Haxe to get the equivalent of Java's abstract methods and abstract classes? What I want is // An abstract class. (Written in a Java/Haxe hybrid.) abstract class Process { public function then( f : A -> Process ) :…
Theodore Norvell
  • 15,366
  • 6
  • 31
  • 45
9
votes
1 answer

Trace without file name and line number in Haxe

Haxe has trace(), which can be used on all targets to print contents. trace("aa"); // Main.hx:89: aa How do I print just the contents, without the file name and line number?
thor
  • 21,418
  • 31
  • 87
  • 173