I'm creating a AIR app and need to arrive at the dot notation path of: air.File.userDirectory.resolvePath
in my function I'm passing in a where param
var where = 'userDirectory';
var f = eval('air.File.'+where+'.resolvePath')(file);
eval would normally work, but in AIR eval is not allowed.
Any other suggestions?
Hurrah for AIR! Eval is evil.
YOu can use an array-index notation instead.
var f = air.File[where].resolvePath(file);
I had tried
var f = alr.File.[where].resolvePath(file);
but found errors.
Thanks for the tip
Oh yeah, there's an obvious mis-spelling there. alr should be air
jQuery.air.js plugin almost ready
pmw's tip also applies to any EMCA (sp?) language like Actionscript, which I'm guessing you use at least occasionally if you're working with Adobe Air.
Its been a couple of years since I have coded any actionscript, but still occasionally find myself casting ie. var myString:String = 'bla bla';
as and js are first cousins and their compilers are the same.