0

我在 Flex (Adobe AIR) 中遇到了一个奇怪的 QNX 问题,我创建了一个 init(); 函数,我在其中添加了 test_list() 函数,但 QNX 列表没有显示在 UI 上。请参阅下面的代码以获取摘要,并查看下面的链接以获取完整代码:

http://pastebin.com/hkzTwSGE

概括

        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);
        }
4

1 回答 1

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"/>
于 2011-07-18T13:36:07.393 回答