开发者

QNX List in Flex not showing up at all!

I am having a strange QNX problem here in Flex (Adobe AIR), I have created an init(); function and in it I have added the test_list() function yet the QNX List is just not showing up on the UI. Please see code below for a summary and the link below for a FULL code:

http://pastebin.com/hkzTwSGE

Summary

        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"});
    开发者_如何学JAVA        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);
        }


You need to add any QNX components to a wrapper. As seen here: http://corlan.org/2011/03/28/creating-playbook-apps-with-flex-and-qnx-ui-components/

So you would need to this to the actionscript:

// this.addChild(myList);
dateWrapper.addChild(myList);

and this to the MXML

<mx:UIComponent id="dateWrapper"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜