tags:

views:

22

answers:

1

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.

+2  A: 
if(Reflect.hasField(obj, propName)) return Reflect.field(obj, propName);

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

Franco Ponticelli
Perfect, thanks
stereofrog