Reflect.setProperty() error 1056


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()
	    Reflect.setProperty(this, "test", true);


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