我正在嘗試構建一個數組,將使用以下語法。我的輸出絕對不是我想要實現的。這裏是我的代碼:Flex:通過陣列循環
var labs:ArrayCollection = new ArrayCollection();
var sets:ArrayCollection = new ArrayCollection();
var labsArray:Array = ["ProDPI","WHCC","Tin"];
var setsArray:Array = ["Set1","Set2","Set3"];
var folders:ArrayCollection = new ArrayCollection();
var foldersArray:Array = [labsArray, setsArray];
var objFolderBuild:Object = new Object;
for (var i:int = 0; i< foldersArray.length;i++) {
for (var j:int = 0; j < foldersArray[i].length; j++) {
objFolderBuild.labName = foldersArray[i][j];
folders.addItem(objFolderBuild);
}
}
labFolderList.labelField="labName";
labFolderList.dataProvider=folders;
setFolderList.labelField="setName";
setFolderList.dataProvider=folders;
我的輸出是作爲6引用「Set3」出來。我的for循環顯然有些問題,但我無法弄清楚。任何想法都會很有幫助。
我是否錯過了實際在代碼中輸出內容的地方?你指的是什麼輸出? – JeffryHouser 2012-03-11 19:11:02
labFolderList.labelField =「labName」<=用這個來改變labelField來填充組合框 – Bungdaddy 2012-03-11 19:13:07