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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -