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

Native Development

Posts: 27
Registered: ‎03-03-2013
My Device: Z10, Q10, Bold 9900, Bold 9700
My Carrier: Rogers

Reference Error on Opening Pooled Card

I'm creating a messaging application which is integrated into hub and I'm having issues with my composer card.  When I open the composer card, I want a "Disconnected" screen to display instead of a list of contacts when the application is not logged into the messaging server.  To acheive this behaviour, I receive a signal once the card has connected to the headless application which contains a flag which tells me if the application is logged into the messaging server or not.  If it's not, I hide the list of contacts and show an error screen in its place.


Now, to the issue.  When I open the card the first time when I'm not connected to the messaging server, everything works as expected.  When I close the card and reopen it, I get reference errors to QML objects in the card where there were no errors before.  Here is a simplified example of my code:


import bb.cascades 1.2

NavigationPane {
    id: composerNavPane

    attachedObjects: [
        ComponentDefinition {
            id: chatCardDefinition
            source: "asset:///ChatCard.qml"

    Page {
        id: composerCardPage
        titleBar: TitleBar {
            id: composerTitleBar
            title: "Select Contact"

        Container {
            horizontalAlignment: HorizontalAlignment.Fill
            verticalAlignment: VerticalAlignment.Fill
            ContactsCard {
                id: contactsCard                

                //This is connected to a signal (not shown)
                function onHeadlessAppConnected(status) {
                    if(status == 0){
                        disconnectedContainer.visible = true
                        contactsCard.visible = false
                    } else {
                        disconnectedContainer.visible = false
                        contactsCard.visible = true

            DisconnectedContainer {
                id: disconnectedContainer
                visible: false

    onPopTransitionEnded: {

This code works fine the first time, but the second time, I get the following error: 

ReferenceError: Can't find variable: contactsCard


I feel like this has something to do with the card pooling, but I'm not sure.  Is there something obvious that I'm doing wrong?