Skip to content
TiVoPublic

About

Convert AS3 sources to their Haxe equivalent

Resources

Stars

14 stars

Watchers

18 watching

Forks

 
 

Latest commit

 

History

285 Commits

Folders and files

Repository files navigation

===========
Config file
===========

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.

indentChars: (String=\t)
	The characters used to indent each line
newlineChars: (String=\n)
	The characters used to terminate each line
bracesOnNewline: (Bool=true)
	If set, opening braces will be put on a new line
uintToInt: (Bool=false)
	If set, all uint in flash will be translated to Int
vectorToArray: (Bool=false)
	If set, all Vectors will be changed to Arrays
guessCasts: (Bool=true)
	Cast guessing should likely be on, as it will change
	any MyClass(obj) to a cast(obj, MyClass) call.
functionToDynamic: (Bool=false)
	If set, Function will be translated to Dynamic
getterMethods: (String=get%I)
	Can be set to change the names of getters.
	%I : field name with first letter capitalized
	%i : field name unchanged (ex. get_%i)
setterMethods: (String=set%I)
	Can be set to change the names of setters
getterSetterStyle: (String="haxe")
	"haxe": a field will be created with haxe style setters
	        and getters. (var m(getM,setM))
	"flash": only native getters and setters will be created
	        using @:getter and @:setter
	"combined": both will be generated

For the "combined" getterSetterStyle, code output will look
similar to:

#if flash
        @:getter(target) function get_target() : {} {
                return proxy;
        }
#else
        override function get_target() : Dynamic {
                return proxy;
        }
#end


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

About

Convert AS3 sources to their Haxe equivalent

Resources

Stars

14 stars

Watchers

18 watching

Forks

Releases

Packages

Contributors

Languages