# Accessing object properties dynamically

**URL:** <https://forum.kirupa.com/t/accessing-object-properties-dynamically/229977>\
**Category:** flash\
**Created:** [June 21, 2007, 6:57pm UTC](https://forum.kirupa.com/t/accessing-object-properties-dynamically/229977 "2007-06-21T18:57:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robx2](https://avatars.discourse-cdn.com/v4/letter/r/b5e925/32.png) [@robx2](https://forum.kirupa.com/u/robx2)\
**Post date:** [June 21, 2007, 6:57pm UTC](https://forum.kirupa.com/t/accessing-object-properties-dynamically/229977/1 "2007-06-21T18:57:20Z")

</div>

This is probably an easy question, but I’m stuck…

I have a custom property called Player (like a basketball player) that has properties for points per game (ppg), rebounds per game (rpg), etc.

I’m designing a piece where users can get averages and compare players across many different categories.

I have a String variable “stat” that tracks which property they want to compare. I can use “stat” in a sorton function, but need to use it to access the object property. So when the user chooses “ppg” or “rpg” i can access Player.ppg and Player.rpg by using the stat variable. Player.stat doesn’t work.

Any suggestions? Thanks in advance.
