Use "bracket notation"

 

var i:int = 1;

return ["image"  + i];  //returns a reference to the component with the
id="image1"

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Ary
Sent: Wednesday, September 19, 2007 12:17 PM
To: [email protected]
Subject: [flexcoders] access a component name using array variable

 

Hi,

i have 3 images, with 'image1', 'image' and 'image3'
as object id,
and i have a function that will return an array index
value of 1,2 and 3

i want to set the image source above depend on the
value returned by the function so if the value
returned 2, i want to set the source of image2

i know 'switch' or nesting if could do the trick
manually, but is there any other way, to make it more
neat and loose?

thank you

ary

__________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you
all the tools to get online.
http://smallbusiness.yahoo.com/webhosting
<http://smallbusiness.yahoo.com/webhosting>  

 

Reply via email to