Hi everyone,
I'm new in haxe development and I have strange problem with getter/setter methods. I compile with command " haxe -swf myswf.swf Main -D as3-native -D swf-protected" , below is my test code in haxe
import flash.display.Sprite;
class Main extends Sprite {
public var radius(get, set):Float;
private var _radius:Float = 10;
function get_radius():Float { return _radius; }
function set_radius(value:Float):Float { return _radius = value; }
public function new () {
radius = 20;
trace("Radius: "+radius);
}
}
After compile to swf I do not have access to variable radius . I decompile with
http://www.showmycode.com/ and this is what I saw:
import haxe. * ;
import flash.display. * ;
public class Main extends Sprite {
protected var _radius: number;
public function Main() : void {
_radius = 10;
super();
set_radius(20);
}
protected function set_radius(_arg1: number) : number {
var _local2: number = _arg1;
_radius = _local2;
return (_local2);
}
protected function get_radius() : number {
return (_radius);
}
}
So what is strange for me . Variable radius is missing. Getter and setter have been set as funcition : "set_radius" and "get_radius()" and not the correct ones "function set radius(..)" and "function get radius()" in AS3. Is this normal behavior for haxe to swf or is some kind of bug ?