Archive for July, 2010

Dynamically Access Properties in Flex

July 27, 2010

I was working on modularizing my actionscript code, by grouping similar tasks in same function. But I came across a problem, where I need to set the values of different properties of the same class.
For eg. I am having code sequence like :

var bot:BottomVO = new BottomVO();
bot.variable1 = (var2*var3)/100;
bot = new BottomVO();
bot.variable2 = (var2*var3)/100;

Here the same values(or calculation of same variables) are set into two different properties of one class. We can use a same method to do this.


private function calc(var2:*,var3:*,prop:String):BottomVO{
var bot:BottomVO = new BottomVO();
bot[prop] = (var2*var3)/100;
return bot;


Happy Coding 🙂

For more reference :


%d bloggers like this: