I have ArrayCollection of strings with field names.
I would like to access object properties dynamically.
var myObject:MyObjectType = new MyObjectType();
var fields:ArrayCollection = new ArrayCollection(["f1", "f2", "f3"] );
for (var index:int = 0; index < (event.result as ArrayCollection).length; index++ ) {
myObject.[fields[index].toString()] = event.result[index];
}
How could I do tat?
You should replace the line inside the for loop by the following:
Also, note that
fieldscontains strings, so you can remove the.toString()part: