0
我不確定是否有更好的方法來做到這一點,如果有請讓我知道。但現在,我有一個名單中的組合框列表。AS3在影片剪輯中選擇組合框
的組合框STU1,屋頂盒2,stu3,抽搐一路63,並在allStudents影片剪輯舉行
for(var i = 0; i < allStudents.length; i++)
{
var newTempStudent:ComboBox = allStudents.getChildAt(i);
newTempStudent.dataProvider.addItem({label: fullName, data:fullName});
newTempStudent.getChildAt(i).dataProvider.sortOn("label");
newTempStudent.getChildAt(i).selectedItem = allStudents.getChildAt(i).getItemAt(i);
}
基本上我試圖:
得到所有63個組合框更新從相同的數據提供程序,
它們按字母順序排序,
然後設置選擇爲每個學生(默認屋頂盒1應顯示數據提供程序(0) ,屋頂盒2應顯示數據提供程序(1),因爲它是默認選擇)
我得到的錯誤是:
場景1,圖層「圖層1」,第1幀,83號線1118:用值隱式強制靜態類型flash.display:DisplayObject到可能不相關的類型fl.controls:ComboBox。
現在我假設我得到了它正在尋找的是顯示對象和執行組合框命令的影片剪輯,但我不知道如何做到這一點本身。
最初我打算用dataGrid做這件事,但當我試圖將dataGrid鏈接到checkBoxes出席時變得太複雜了。
任何和所有的幫助,非常感謝!
這仍然不能解決問題:( – 2013-04-22 19:02:50
嗯,讓我澄清...它修復了這種...我現在得到一個新的錯誤:訪問可能未定義的屬性dataProvider通過引用與靜態類型flash.display:DisplayObject,通過具有靜態類型的引用調用可能未定義的方法getItemAt flash.display:DisplayObject,通過具有靜態類型的引用可能未定義的屬性selectedItem的訪問flash.display:DisplayObject – 2013-04-22 19:05:28
這不是一個正在進行的如果錯誤消失了,那就回答這個問題,如果你有其他錯誤或問題,請發表另外一個問題。 – prototypical 2013-04-22 19:08:37