我在 Flex (Adobe AIR) 中遇到了一个奇怪的 QNX 问题,我创建了一个 init(); 函数,我在其中添加了 test_list() 函数,但 QNX 列表没有显示在 UI 上。请参阅下面的代码以获取摘要,并查看下面的链接以获取完整代码:
概括
private function init() : void {
credentials = String(data);
var arr:Array = new Array();
arr.push("item 1");
arr.push("item 2");
indexArrayCollection = new ArrayCollection();
subsonicIndexList = new DataProvider(arr);
//subsonicIndexList = new DataProvider(indexArrayCollection.source);
//get_indexList(null);
test_list();
}
private function test_list() : void {
var arrMonth:Array=[];
// add objects with a label property
arrMonth.push({label: "January"});
arrMonth.push({label: "February"});
arrMonth.push({label: "March"});
arrMonth.push({label: "April"});
arrMonth.push({label: "May"});
arrMonth.push({label: "June"});
arrMonth.push({label: "July"});
arrMonth.push({label: "August"});
arrMonth.push({label: "September"});
arrMonth.push({label: "October"});
arrMonth.push({label: "November"});
arrMonth.push({label: "December"});
var myList:List = new List();
myList.setPosition(100, 100);
myList.width = 300;
myList.height = 400;
myList.columnWidth = 100;
//set the dataProvider
myList.selectionMode = ListSelectionMode.MULTIPLE;
myList.scrollDirection = ScrollDirection.VERTICAL;
myList.dataProvider = new DataProvider(arrMonth);
myList.addEventListener(ListEvent.ITEM_CLICKED, showAlert);
myList.addEventListener(ScrollEvent.SCROLL_END, showAlert);
myList.addEventListener(ScrollEvent.SCROLL_BEGIN, showAlert);
this.addChild(myList);
}