• Stars
    star
    174
  • Rank 219,104 (Top 5 %)
  • Language Haxe
  • License
    MIT License
  • Created over 11 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Convert AS3 sources to their Haxe equivalent

as3hx Build Status

Convert ActionScript 3 to Haxe 3 code.

Note: This repository is no longer actively maintained. Please refer to https://github.com/innogames/ax3 as an alternative!

Build

You'll need Haxe 3.* to build the project and Neko 2.* to run it.

haxe --no-traces as3hx.hxml

Build the as3hx tool.

haxe -debug as3hx.hxml

Build with debug output when converting files.

Use

neko run.n test/ out/

This will take all the ActionScript 3 files in the test/ directory and generate the corresponding Haxe files in out/

To generate the tests you can also use :

make run-test

This will generate the tests in test-out

To get the basic tool usage :

neko run.n -help

Config

There are many configuration options to choose how the Haxe code is generated, check the src/as3hx/Config.hx file for the full list.

as3hx looks for, or creates, a config file in your home directory called ".as3hx_config.xml". You can also create one in the directory you are running as3hx from, which will override the home file.

Licence

MIT, see LICENCE.md

Current failures:

'delete' keyword:

In ActionScript, the delete keyword will cause an intentional failure in the generated .hx file. Take a close look at the object being deleted.

  1. if it is a local variable, replace delete varname with varname = null
  2. if it is a class member variable, remove the delete entirely
  3. it it is an E4X (FastXML), well, hmmm... still working on that one.

Senocular did a little writeup on delete that might make it more clear http://www.kirupa.com/forum/showthread.php?223798-ActionScript-3-Tip-of-the-Day/page3

E4X:

E4X is currently partly done. This will fail in some cases, just examine source and output carefully.

For Initializations:

The output of

if (true) {
    for (var i:uint = 0; i < 7; i++)
        val += "0";
} else {
    for (i = 0; i < 8; i++)
        val += "0";
}

is

if (true) {
    var i:UInt = 0;
    while (i < 7) {
        val += "0";
        i++;
    }
} else {
    i = 0;
    while (i < 8) {
        val += "0";
        i++;
    }
}

As you can see, the scope of i in Flash is not the same as in Haxe, so the else section will produce Unknown identifier : i. The solution is to move the var i : UInt = 0; outside of the blocks in the generated code.

This can not be avoided by always creating the i variable, as the code

for (var i:uint = 0; i < 7; i++)
    val += "0";
for (i = 0; i < 8; i++)
    val += "0";

would then produce a double initialization of i, also causing a compiler error.

var i:UInt = 0;
while (i < 7) {
    val += "0";
    i++;
}
var i = 0;
while (i < 8) {
    val += "0";
    i++;
}

More Repositories

1

haxe

Haxe - The Cross-Platform Toolkit
Haxe
6,166
star
2

hashlink

A virtual machine for Haxe
C
810
star
3

neko

The Neko Virtual Machine
C
553
star
4

hxcpp

Runtime files for c++ backend for haxe
C++
297
star
5

hscript

Parser and interpreter for Haxe expressions
Haxe
262
star
6

intellij-haxe

Haxe plugin for IntelliJ Platform based IDEs (IDEA, Android-Studio)
Java
220
star
7

HaxeManual

The official Haxe manual
Haxe
218
star
8

haxelib

The Haxe library manager
Haxe
172
star
9

hxnodejs

Haxe externs for working with node.js
Haxe
171
star
10

dox

Haxe documentation generator.
Haxe
146
star
11

format

Various files formats support for Haxe
Haxe
131
star
12

code-cookbook

The Haxe Code Cookbook - A community driven resource website for learning Haxe in practise
Haxe
112
star
13

haxe-evolution

Repository for maintaining proposal for changes to the Haxe programming language
111
star
14

haxe.org

The haxe.org website
HTML
81
star
15

haxe-markdown

A Markdown parser in Haxe.
Haxe
63
star
16

hxcs

Haxe C# support library. Build scripts and support code.
Haxe
57
star
17

record-macros

Macro-based ORM (object-relational mapping)
Haxe
49
star
18

hxcpp-debugger

Cross-platform debugger for hxcpp
Haxe
49
star
19

crypto

Cross platform cryptographic functions for Haxe
Haxe
48
star
20

npm-haxe

Install Haxe using Node Package Manager aka npm
JavaScript
46
star
21

hxjava

Haxe Java support library. Build scripts and support code.
Haxe
46
star
22

tora

NekoVM Application Server
Haxe
30
star
23

docker-library-haxe

Docker official image for Haxe
Dockerfile
28
star
24

ocamllibs

Various OCaml Libraries
OCaml
24
star
25

Project-Management

Project management and communication
20
star
26

haxedevelop.org

Website content and sources
Haxe
19
star
27

try.haxe.org

run Haxe code snippets in your browser
Haxe
18
star
28

hx3compat

Haxe 3 compatibility lib for Haxe 4
Haxe
16
star
29

html-externs

HTML externs for Haxe
IDL
15
star
30

hxnodelibs

Haxe
14
star
31

ocamhaxe

OCaml distribution for Haxe compilation
Haxe
11
star
32

haxe-debian

Debianizing Haxe
Haxe
11
star
33

api.haxe.org

Haxe API documentation
Haxe
10
star
34

hxgithub

Haxe
8
star
35

haxe-terraform

Haxe Foundation infrastructure
HCL
5
star
36

nekovm.org

The website for NekoVM.
Haxe
5
star
37

neko-debian

Debianizing Neko
C
4
star
38

build.haxe.org

Snapshot build storage web UI
Haxe
3
star
39

hx4compat

Haxe 4 compatibility lib for Haxe 5, or maybe the other way aroun?
Haxe
3
star
40

haxe.org-comments

Repository to collect comments of our haxe.org websites
2
star
41

hashlink.haxe.org

HTML
2
star
42

homebrew-haxe

Haxe formulae for the Homebrew package manager
Ruby
1
star
43

summit.haxe.org

Haxe
1
star
44

haxe-deps

A luarocks spec for the dependencies required for the Haxe Lua target
Lua
1
star
45

haxe-choco

Chocolatey Haxe package
Haxe
1
star