RE: [flexcoders] String to object reference?
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: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Mike Chang Sent: Tuesday, March 09, 2010 11:13 AM To: flexcoders@yahoogroups.com 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
Re: [flexcoders] String to object reference?
Thanks! On Tue, Mar 9, 2010 at 11:58 AM, Gordon Smith gosm...@adobe.com wrote: 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:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *Mike Chang *Sent:* Tuesday, March 09, 2010 11:13 AM *To:* flexcoders@yahoogroups.com *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