As of late 2021, we are in the process of updating Stencylpedia and fixing up outdated & broken content. Thanks for your patience!

33,014

Views

Expert

Level

6

Comments

Haxe Primer

by Jon (Updated on 2015-10-21)


Contents

  • Introduction
  • Differences
  • Further Reading

 

Introduction

With our move towards a unified, cross-platform enginem we've adopted Haxe, a language that's remarkably similar to ActionScript 3, but at the same time, has enough small differences to force all existing code to be ported. This guide is a light introduction to Haxe for AS3 developers.

 

Differences

All differences are clearly illustrated on OpenFL's Haxe for AS3 Primer. We recommend reading this while we build our own guide.

 

Areas where the basic syntax and structures are different include...

  • Basic Types are slightly different and all capitalized.
  • Package Declarations are done Java-style.
  • Class Definitions don't include public. Constructors are defined using new rather than
  • For Loops have a more concise syntax.
  • Casting has a different syntax.
  • Checking for "null" has to be done explicitly.
  • No Dictionaries, but Haxe has strongly-typed Maps.
  • Function pointers have to be typed explicitly.
  • Getter/Setter syntax is different.
  • All package must be in lower-case, but all class names must start with upper case.
  • You can't import classes using wildcards.

 

Further Reading

Disclaimer: Use comments to provide feedback and point out issues with the article (typo, wrong info, etc.). If you're seeking help for your game, please ask a question on the forums. Thanks!

6 Comments

1532985
4
0 8 years, 5 months ago
CmdrWhitey13
Under Introduction-> Typo

Introduction

"With our move towards a unified, cross-platform enginem"

should be engine and not enginem.

0 8 years, 9 months ago
Jon
Got broken when they redid their site. I've fixed the link now.
0 10 years, 6 months ago
mikhog
Link to AS3 developer guide doesn't work
1 10 years, 6 months ago
flava621
Just go here to read up on it http://haxe.org/doc
0 10 years, 7 months ago
teacherpeter
Nothing?
0 10 years, 7 months ago

Sign In to Comment