Use "bracket notation".  For instance:

this["director" + i].text = "some text";

will work if there is a control with that concatenated id.

 

In 1.5 you could use this method to create variable on the application
object, but in 2.0 that doesn't work anymore, I think because the
application object is no longer dynamic.

 

Tracy

 

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of bitfacepatrick
Sent: Friday, December 22, 2006 7:29 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] dynamic control access

 

Hello is there a way to build a reference to a control at runtime
something like this? I know this doesn't work I don't know how else to
describe it. Is there a command similar to getElementById()?

for (var i:int -0; i , myArray.length; i++)
{

"director" + [i] + ".text" = "some text";

}

I have a number of text input controls all named like, director1,
director2, director3, director4...

 

Reply via email to