我在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);
}
答案 0 :(得分:1)
您需要将任何QNX组件添加到包装器。如下所示: http://corlan.org/2011/03/28/creating-playbook-apps-with-flex-and-qnx-ui-components/
所以你需要这个动作脚本:
// this.addChild(myList);
dateWrapper.addChild(myList);
这是MXML
<mx:UIComponent id="dateWrapper"/>