Question

I might be missing something obvious, but how do I reference a property indirectly? E.g in javascript it would be:

 if(propName in obj) return obj[propName];

How to say the same in haxe? The object in question is Dynamic<String>, flash.display.LoaderInfo.parameters to be specific.

Many thanks.

Was it helpful?

Solution

if(Reflect.hasField(obj, propName)) return Reflect.field(obj, propName);

Althought it seems more code, the generated output is basically the same.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top