Yes, no doubt, that will work. Thanks. Forgot about that totally.
However, out of curiousity, what if the movieclip is not a child ? It’s only a public variable. Or say, it’s not any movieclip but a simple public variable. Is it possible to access it through array in that case, in OpenFl ?
PS: Anyway, I think I can test that… will update the answer here.
If You are thinking about access operator like in c ( char p ~= char q[ ]), then I think it is not possible (Maybe with cast to abstracts…? like https://haxe.org/manual/types-abstract-operator-overloading.html).
Generally in OpenFl Haxe You don’t have posibillity to operate on pointers, so there is no control over objects placement - what You will point to when You will check memory sizeof(void) further. So even if this will work (it will return something, instead of crashing), it will be probably random data
Yeah, Reflect is what you’re looking for. But since you’re dealing with DisplayObjects, you’ll want to use Reflect.getProperty() and Reflect.setProperty():
var numChildren = Reflect.getProperty (clip, "numChildren");
Reflect.setProperty (clip, "x", 100);
In @singmajesty’s example, Reflect.field() would have compiled because numChildren is declared “(get, null),” making it a physical field. However, since nothing ever assigns to it, it constantly stays at 0. I’m working on a pull request that will turn it into a non-physical field and save some memory, but that isn’t relevant to this thread, since either way the solution is to use getProperty() and setProperty().