Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Contributor
louislu
Posts: 2
Registered: ‎11-04-2010
My Device: Not Specified

Re: Using QNX components in MXML?

The code is much cleaner for layout with mxml than as3, I have managed to replicate the Container example at http://www.blackberry.com/developers/docs/airapi/1.0.0/index.html using QContainer:

 

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:r="http://ns.renaun.com/mxml/2010"
                       xmlns:s="library://ns.adobe.com/flex/spark"
                       xmlns:mx="library://ns.adobe.com/flex/mx"
                       xmlns:btn="qnx.ui.buttons.*"
                       xmlns:core="qnx.ui.core.*"
                       xmlns:txt="qnx.ui.text.*"
                       xmlns:ftxt="flash.text.*"
                       width="1024" height="600">
    <fx:smileyvery-happy:eclarations>
        <ftxt:TextFormat id="labelFormat" size="22"/>
    </fx:smileyvery-happy:eclarations>
    <fx:smileyfrustrated:cript>
        <![CDATA[
            [Bindable]
            private var myMain_margins:Vector.<Number> = Vector.<Number>([20,20,20,20]);
            [Bindable]
            private var mySub_margins:Vector.<Number> = Vector.<Number>([20,40,20,40]);
            [Bindable]
            private var mySubRight_margins:Vector.<Number> = Vector.<Number>([10,10,10,10]);
            [Bindable]
            private var mySubBottom_margins:Vector.<Number> = Vector.<Number>([5,5,5,5]);                        
        ]]>
    </fx:smileyfrustrated:cript>    
    <r:QContainer id="myMain" flow="horizontal" debugColor="0xFFCC00" margins="{myMain_margins}">
        <r:QContainer id="mySub" size="50" sizeUnit="percent" debugColor="0xFF3300" margins="{mySub_margins}" flow="vertical" align="near" padding="10">
            <txt:Label id="firstLabel" text="First label" autoSize="left" size="50" sizeUnit="percent" format="{labelFormat}"/>
            <txt:Label id="secondLabel" text="Second label" autoSize="left" size="50" sizeUnit="percent"  format="{labelFormat}"/>
            <txt:Label id="thirdLabel" text="Third label" autoSize="left" size="50" sizeUnit="percent"  format="{labelFormat}"/>
        </r:QContainer>
        <r:QContainer id="mySubRight" debugColor="0x0033FF" margins="{mySubRight_margins}" size="50" sizeUnit="percent" flow="vertical" align="mid" padding="10">
            <core:smileyfrustrated:pacer size="60" sizeUnit="percent"/>
            <txt:Label id="fourthLabel" text="Fourth label:" width="200" size="30" sizeUnit="pixels"/>
            <txt:TextInput id="firstInput" width="200"/>            
        </r:QContainer>
        <r:QContainer id="mySubBottom" debugColor="0x33FF33" margins="{mySubBottom_margins}" size="12" sizeUnit="percent" flow="horizontal" align="far" padding="10" containment="bottom">
            <core:smileyfrustrated:pacer/>
            <btn:LabelButton id="leftButton" size="100" sizeUnit="pixels" sizeMode="both" label="Back"/>
            <btn:LabelButton id="rightButton" size="100" label="Next"/>
            <core:smileyfrustrated:pacer size="3" sizeUnit="pixels"/>
        </r:QContainer>
    </r:QContainer>    
</s:WindowedApplication>

Please use plain text.
New Contributor
tdbrian
Posts: 6
Registered: ‎11-02-2010
My Device: Tablet

Re: Using QNX components in MXML?

I can get <r:QContainer /> to work fine in Flex 4.1 SDK <s:WindowedApplication/>, but when I try to implement in Flex 4.5 SDK in a View component I get compile errors... 

 

I'm using 4.5 SDK and Hero components to build my application for the Playbook, but need to use a qnx list component as it has some event handlers and methods the Hero list component does not have- especially scrollToIndex() method and the scrollEnd  event...

 

Is it possible to get the qnx list component to work in a Hero view component?

 

I've tried http://renaun.com/blog/2010/12/using-mxml-with-qnx-ui-components-for-the-playbook/ except in the view component and I get a coercion error on the r:QContainer? 

 

I've added the following build path libraries to my project:

 

QMXML.swc

qnx-screen.swc

qnx-air.swc 

 

Any ideas?

Please use plain text.
Regular Contributor
renaun
Posts: 86
Registered: ‎10-25-2010
My Device: Not Specified

Re: Using QNX components in MXML?

[ Edited ]

Make sure in your Project -> Properties -> Flex Build Packaging -> BlackBerry Tablet OS you have "Include BlackBerry Tablet libraries in build path" selected. Its best to use this option instead of adding the swc's manually to your build path.

 

I just double checked it and it worked for me. I confirmed the error and then included the swc's, the errors go away and then it compiled. (it does seem this preview release of Burrito is quirky with this error, so worst case you can turn off the "strict type checking mode" in the Compiler options, and then turn it back on after the swc's are included).

blog: http://renaun.com
twitter: @renaun
Please use plain text.
New Contributor
tdbrian
Posts: 6
Registered: ‎11-02-2010
My Device: Tablet

Re: Using QNX components in MXML?

errorScreen.jpgThanks Renaun, I just tried "include BlackBerry Tablet libraries in build path" and it did add blackberry.swc, but I am still getting the errors. I attached a screen shot.

 

When I try to compile, I confirm the errors but it never compiles. Maybe I am setting up the code wrong?

 

Thanks again for your help. I will keep playing around and see if I get anywhere with it.

Please use plain text.
New Contributor
tdbrian
Posts: 6
Registered: ‎11-02-2010
My Device: Tablet

Re: Using QNX components in MXML?

I did get it working!! Thanks again Renaun.. you saved me at least two days of work. :smileyvery-happy:

Please use plain text.
New Developer
austin85251
Posts: 16
Registered: ‎01-11-2011
My Device: Not Specified

Re: Using QNX components in MXML?

@tdbrian-

I'm getting the same warnings about loading the QMXML.swc file. Can you share what you did to resolve this? Thanks

Please use plain text.
Regular Contributor
renaun
Posts: 86
Registered: ‎10-25-2010
My Device: Not Specified

Re: Using QNX components in MXML?

It might have been a sdk mismatch. I have updated teh QMXML.swc to be compiled against the 0.9.2 SDK. Update all the projects, sdks, and get the newer QMXML.swc to see if that takes care of the errors.

 

Renaun

blog: http://renaun.com
twitter: @renaun
Please use plain text.
Developer
UberschallSamsara
Posts: 1,017
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Using QNX components in MXML?

I'm trying to get up to speed on QMXML so sorry if this is an FAQ.

 

From other threads on simulator issues I gather the latest simulator must be used with the latest SDK; no mixing of sim & SDK releases should be expected to work.  Ideally I'd like to test vs. latest simulator in all cases but that means migrating to the latest SDK.

 

Do you plan to maintain versions of the SWC compiled against the different SDK's, or can you publish your compilation commandlines with examples so we can drop in whichever SDK version we're compiling against and generate our own copy of QMXML.swc?  I'm sure it's simple but I'm new to Flash and also it will probably pre-empt any confusion if all interested folks are compiling their own custom SWC's using same/similar commandlines.

Please use plain text.
Regular Contributor
renaun
Posts: 86
Registered: ‎10-25-2010
My Device: Not Specified

Re: Using QNX components in MXML?

All the source code for QMXML is available on https://github.com/renaun/FlexMXMLAndQNXUIComponents . You can take that code and compile/modify it how every you want.

 

 

blog: http://renaun.com
twitter: @renaun
Please use plain text.
Developer
UberschallSamsara
Posts: 1,017
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Using QNX components in MXML?

Yes, understood, but what's your compilation commandline for the SWC compile? (I haven't compiled a SWC before, not sure if there are any gotchas for what options to use with compc)

Please use plain text.