metahipster
10-18-2005, 10:59 PM
Here's the basic setup:
array contains multiple objects
each object has the same properties, though different values stored in their various properties.
Thus array[0].color could return something like "blue".
array[0].radius might return 50.
Now, I want to vary how I'm asking for the property... sometimes I might want radius, sometimes color.
I thought it would be something like
attrib="color";
trace(array[0][attrib]);
That doesn't seem to work. What am I doing wrong? If my logic is sound, I'll post some code to follow up... It's mighty convoluted so hopefuly you can answer me purely on a conceptual level using the above example to guide the syntax.
Thanks!
array contains multiple objects
each object has the same properties, though different values stored in their various properties.
Thus array[0].color could return something like "blue".
array[0].radius might return 50.
Now, I want to vary how I'm asking for the property... sometimes I might want radius, sometimes color.
I thought it would be something like
attrib="color";
trace(array[0][attrib]);
That doesn't seem to work. What am I doing wrong? If my logic is sound, I'll post some code to follow up... It's mighty convoluted so hopefuly you can answer me purely on a conceptual level using the above example to guide the syntax.
Thanks!