I’m new to actionscript and want to write the following code in for loop style.
It is a menu loaded from a xml file
nav_menu.nav_1.text=gallery_xml.gallery[0].@name;
nav_menu.nav_2.text=gallery_xml.gallery[1].@name;
nav_menu.nav_3.text=gallery_xml.gallery[2].@name;
nav_menu.nav_4.text=gallery_xml.gallery[3].@name;
nav_menu.nav_5.text=gallery_xml.gallery[4].@name;
nav_menu.nav_6.text=gallery_xml.gallery[5].@name;
nav_menu.nav_7.text=gallery_xml.gallery[6].@name;
I tried write as an array. The tracing result of the array was right. But I don’t know how to put the array into the dynamic textbox…
Thank you very much for helping.
I think you’re looking for a for loop
Try something like this, assuming gallery is in fact an array.
This will start at 0 in your gallery array and continue until 6 (your array length). The var i will represent the current index in the array. i + 1 looks like it’s the corresponding text field