I’m trying to override the width property of a sprite.
After many tests I have the expected result working on flash and IOS… But I do not find any other way than using with conditionnal compilation… I’m probably missing someting.
Any idea to have an unique code running on all targets ?
#if flash
@:getter(height)
public function getHeight():Float {
return _height;
}
@:setter(height)
public function setHeight(value:Float):Void {
_height = value;
}
#else
override function get_height():Float {
return _height;
}
override function set_height(value:Float):Float {
_height = value;
return _height;
}
#end
If you override a Haxe method, you can just override the “get_” or “set_” method, but this is different than overriding a built-in ActionScript class property, which works with @:getter or @:setter