Dynamically created list with AllowMultipleSelection=true - I can not
load selectedItems or selectedIndices. When I set either array, they
are there at debug time, but do not show as selected in the list.
//add list field
var newList:List = new List;
newList.percentWidth=100;
newList.allowMultipleSelection=true;
var newListDP:Array = new Array;
var newListSelected:Array = new Array;
//here's where the dataprovider (newListDP) array and selectedItems
//(newListSelected) array.
for (var y:int=0; y<fieldsAC[x].dropdownvalues.value.length; y++) {
newListDP[y] = fieldsAC[x].dropdownvalues.value[y];
for (var z:int=0; z<fieldsAC[x].data.id.length; z++) {
var indexString:String = fieldsAC[x].dropdownvalues.value[y].id
if (indexString.indexOf(fieldsAC[x].data.id[z]) != -1) {
newListSelected.push(fieldsAC[x].dropdownvalues.value[y].label);
}
}
}
newList.selectedItems = newListSelected;
newList.dataProvider = newListDP;
BindingUtils.bindProperty(fieldsAC
[x],"data",newList,"selectedIndices");
newFormItem.addChild(newList);