actionscript 3 - Actionscript3, dynamic text, loop, xml -
i have 6 dynamic text fields & want add text in them xml file.
this code works:
titletxt1.text = xmllistmain.children()[0].title;
but in loop there problem:
for (var i:number = 0; < xmllistmain.children().length(); i++) { titletxt[i].text = xmllistmain.children()[i].title }
titletxt[i].text
part error. how can fix this?
if first textfield named titletxt0.text (ie numbering starts 0):
for (var i:number = 0; < xmllistmain.children().length(); i++) { this['titletxt' + i].text = xmllistmain.children()[i].title; }
if first textfield named titletxt1.text (ie numbering starts 1):
for (var i:number = 0; < xmllistmain.children().length(); i++) { this['titletxt' + (i + 1)].text = xmllistmain.children()[i].title; }
better start numbering 0 things can omit step of adding 1 loop's index.
Comments
Post a Comment