Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you name actionscript entities dynamically??

Status
Not open for further replies.

clemrock

Programmer
May 20, 2004
118
US
Hello,

I am trying to find a more gracefull way to code actionscript entities w/ in a more dynamic fashion.

For instance, I am populating dropdown menus by looping through an XML file.
Rather than addressing the attributes one by one like this:
subnode_2[k].attributes.option_1_branch,
subnode_2[k].attributes.option_2_branch,
subnode_2[k].attributes.option_3_branch...

It rather than addressing each one separately, it would be nice to loop in this manner:

for( var i = 0; i < 10; i++ )
{
if( subnode_2.attributes.option_" + i + "_branch" != undefined )
{
'mc_code_option_'+i+'_dd'.txt_code_value =
subnode_2.attributes.code_value;
}
}
 
no reson why you cant loop like that but i am puzzled by this line

'mc_code_option_'+i+'_dd'.txt_code_value =


should it be

mc_code_option_ + i + _dd.txt_code_value =
 
Actually, just trying to print something simple like:

trace (" output: " + subnode_2[k].attributes.mc_code_option_ + k + _dd );

will print it as "undefined0undefined", "undefined1undefined"

Thanks for your time,

Clem C

 
try posting more of the script....dificult to say whats causing the undefined without more info
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top