Reflect.setProperty() error 1056

Hello,

I have an error 1056 on flash target with Reflect.setProperty()
impossible to create test property on DocumentClass

import openfl.display.Sprite;

class Main extends Sprite
{
    public function new()
    {
        super();
	    
	    Reflect.setProperty(this, "test", true);
    }
}

Thanks

Why would you want to do that anyway? Seems like there’s probably a better / more strictly typed solution to whatever you’re trying to do.

I tried to create a typed variable but hasOwnProperty() not exist in OpenFl ?

We implement hasOwnProperty in openfl.utils.Object

I think you can add fields using Reflect.setField, but beware, this makes objects dynamic and reduces performance