You can access the properties of any object by name, using square-bracket 
notation. For example, o.p can be written o["p"]. In this case, the relevant 
object is 'this', so you want

this["california"]
this["california" + "_over"]

Gordon Smith
Adobe Flex SDK Team

From: [email protected] [mailto:[email protected]] On Behalf 
Of Mike Chang
Sent: Tuesday, March 09, 2010 11:13 AM
To: [email protected]
Subject: [flexcoders] String to object reference?



Hi,
I was wondering if it's possible to change a string to an object name.
For example, I pass a string "california", and there's an object named
california. I would like to reference the california object.

For example, this is my code right now:
case "california":
up = california;
over = california_over;
break;

I would like to have
up = californiaString > to object;
over = californiaString + "_over" > to object.

Thanks,
Mike

Reply via email to