Hi there guys I have a little problem when targeting swc when it comes to getters/setters. First problem was that everything is made public once compiled which can be easily resolved by specific prefix so users can avoid.
So lets say I have my private variable like this:
private var pv_something:Float;
No to the getter/setter setup obviously the get/set functions we need to specify for haxe will be made public and will work as functions instead as a getter/setter once inside AS3. This was resolved thanks to luce the following way:
#if swc @:extern #end
public var something(get, set):Float;
#if swc @:getter(something) #end
inline private function get_something():Float {
return pv_something;
}
#if swc @:setter(something) #end
inline private function set_something(p_value:Float):Float {
return pv_something = p_value;
}
So now the getters look and work like they should inside AS3 envrinment HOWEVER it breaks up the internal code inside haXe compiled code once we are using it in AS3.
Here is an example if I have another method somewhere in the class accessing the getter like this:
private otherMethod():Void {
if (something == 0) ...
}
This will work in haXe but if we run this through AS3 using the SWC it will throw an error that there is not such method as get_something
Any suggestions? Thanks.