haxe: Indirect property referencing
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开发者_如何学Python haxe? The object in question is Dynamic<String>
, flash.display.LoaderInfo.parameters
to be specific.
Many thanks.
if(Reflect.hasField(obj, propName)) return Reflect.field(obj, propName);
Althought it seems more code, the generated output is basically the same.
精彩评论