Made a coupple of tests more. I set a rotation of 10 to the “panioApuestas” sprite, to make sure it will be a used property. It makes the initial rotation correctly but when It makes the tween thru actuate it ignores them completelly.
As far as I test, there are no problem with actuate and position and scale. Only with rotation, so as simple solution I will add @:keep for rotation in the displayObject class. Not sure if using macros you should be able to evaluate which properties are needed by actuate and keep only that ones. But that exceeds my knowledge with haxe (for now )
Hi guys,
Any cleaner fix issued for that problem?
I’ve been running into the same problem today, but this time with a classic openfl Sprite, not a custom one.
Cheers,
EDIT: I can make it work by setting my Sprite rotation to its own rotation + any value, then setting it back to 0, but that’s definitely an ugly workaround
@:keep private static function callGetterAndSetter():Void {
new Sprite().rotation += 0;
}
By calling the setter, you let DCE know not to remove it. You don’t even need to call callGetterAndSetter() at runtime; it just needs to be there at compile time.
The alternative is to open up DisplayObject.hx, and add @:keep above the class declaration.
Ok thanks for the answer !
I figured out something like that might work, I was just looking for something cleaner and in a more centralized place
Wouldn’t it be nice to have a dead code elimination list of packages we want to keep or that we absolutely don’t need?
We would specifiy there classes or packages that we know we need / don’t need and the dce would parse that and act accordingly…?
You can use initialization macros for both things. Normally you’d add them in the command line, but I think in OpenFL’s case, you’ll be able to use a <haxeflag /> tag.
To stop DCE from removing a class:
--macro keep("openfl.display.DisplayObject")
To prevent a class or package from being generated, potentially causing compile-time “type not found” errors: