Thanks Ned.
Actually I this is the area I wanted to be shortened.
my_list1.addItem("fnt1", "fnt1");
my_list1.addItem("fnt2", "fnt2");
my_list1.addItem("fnt3", "fnt3");
my_list1.addItem("fnt4", "fnt4");
my_list1.addItem("fnt5", "fnt5");
//then the 2nd my_list
my_list2.addItem("fnt1", "fnt1");
my_list2.addItem("fnt2", "fnt2");
my_list2.addItem("fnt3", "fnt3");
my_list2.addItem("fnt4", "fnt4");
my_list2.addItem("fnt5", "fnt5");
//then the 3rd my_list
my_list3.addItem("fnt1", "fnt1");
etc...
//up to the 8th my_list
As I mentioned, you can use a loop that feeds from an array to reduce that. Without the loop you wouldn't reduce it.
var fontArray1:Array = new Array("font1","font2", etc...);
for(i=0; i<fontArray1.length; i++){
my_list1.addItem({label: fontArray1, data: fontArray1});
}
And you could extend that to be a loop within loop to take care of all the lists, where the outer loop changes wihich list you load into and the inner fills each in turn...
var fontArray1:Array = new Array("font1","font2", etc...);
var fontArray2:Array = new Array("font6","font7", etc...);
etc... thru fontArray8
for(k=1; k<9; k++){
for(i=0; i<fontArray1.length; i++){
this["my_list"+k].addItem({label: this["fontArray"+k], data: this["fontArray"+k]});
}
}
If the same array would be used for each, then in the inner loop you would just use...
this["my_list"+k].addItem({label: fontArray1, data: fontArray1});
And you should still look into the dataProvider as an alternative for using an array to load the Lists. If they all use the same array, that would make quicker coding of it than your original code as well, though probably not to the extent of the loop.