Search

 

May 2011
S M T W T F S
« Apr   Jun »
1234567
891011121314
15161718192021
22232425262728
293031  

Tags

Archives


« | Main | »

QNX components within Flex for BlackBerry

By Rich Tretola | May 26, 2011
9,358 views

Did you know that you can use QNX components within BlackBerry Tablet OS? This is a snippet of some of the things you will see in my next book Developing Blackberry Tablet Applications with Adobe Flex 4.5.

Since the qnx library components do not inherit from Flex base UI components so you will have to declare they either in the declarations block and add them to a UIComponent wrapper or create the instance of them with ActionScript and a add them with ActionScript to a UIComponent wrapper. I chose option 1 below.

Be sure to check the box that says “Add platform specific libraries to library path” within Properties > Flex Build Packaging > BlackBerry Tablet OS.

Here is a simple example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               applicationComplete="application1_applicationCompleteHandler(event)"
               xmlns:picker="qnx.ui.picker.*" xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Declarations>
        <picker:Picker id="monthPicker"/>
        <picker:Picker id="yearPicker"/>
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
           
            import qnx.ui.data.DataProvider;
            private var monthArray:Array =  [{label: "January", data:0},
                 {label: "February", data:1},
                 {label: "March", data:2},
                 {label: "April", data:3},
                 {label: "May", data:4},
                 {label: "June", data:5},
                 {label: "July", data:6},
                 {label: "August", data:7},
                 {label: "September", data:8},
                 {label: "October", data:9},
                 {label: "November", data:10},
                 {label: "December", data:11}];
            private var yearArray:Array = [{label: "2011", data:0},
                {label: "2012", data:1},
                {label: "2013", data:2},
                {label: "2014", data:3},
                {label: "2015", data:4}];
           
            protected function application1_applicationCompleteHandler(event:FlexEvent):void
            {
                monthPicker.dataProvider = new DataProvider([new DataProvider(monthArray)]);
                monthPickerHolder.addChild(monthPicker);
                yearPicker.dataProvider = new DataProvider([new DataProvider(yearArray)]);
                yearPickerHolder.addChild(yearPicker);
            }
           
        ]]>
    </fx:Script>   
    <mx:UIComponent id="monthPickerHolder" y="50" x="150"/>
    <mx:UIComponent id="yearPickerHolder" y="50" x="300"/> 
</s:Application>

Here is the output:

Topics: Adobe AIR, blackberry, Flex | 2 Comments »

2 Responses to “QNX components within Flex for BlackBerry”

  1. Raymond Camden Says:
    May 26th, 2011 at 4:12 pm

    Is there a good list of the QNX components, perhaps with pictures?

    Reply to this comment

    Rich Tretola Reply:

    Ray,

    Here is a picture of the ones I cover in my upcoming book.

    The docs are here: http://www.blackberry.com/developers/docs/airapi/1.0.0/index.html

    Reply to this comment

Comments