Git Product home page Git Product logo

as3hx's Introduction

as3hx Build Status

Convert ActionScript 3 to Haxe 3 code.

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++;
}

as3hx's People

Contributors

adamharte avatar andyli avatar bryant1410 avatar grumpytoad avatar jasonsturges avatar jgranick avatar lylecox avatar ncannasse avatar sbijoshj avatar scabwort avatar sganapavarapu1 avatar simn avatar slavara avatar yanhick avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.