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

Native Development

Reply
Highlighted
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later
Accepted Solution

unable to get asset

"Unable to get asset in (/apps/com.netvariant.AlKhaliji.testDev_t_AlKhalijif045bd7c/native/assets/): (/images/background.amd)."
Meta data not found:  "/images/background.amd"
"Unable to get asset in (/apps/com.netvariant.AlKhaliji.testDev_t_AlKhalijif045bd7c/native/assets/): (/images/background.amd)."

 

 

despite i have background.amd under my images folder..plus backgroun.png

 

#RimCascadesAssetMetaData version=1.0
source: "background.png"
sliceMargins: 15 15 15 15

 

import bb.cascades 1.0

NavigationPane {
    id: summaryNavigationPane
    objectName: "summaryNavigationPane"
    onPopTransitionEnded: { page.destroy(); }
Page {
    attachedObjects: [
        ComponentDefinition {
            id: summaryDetails
            source: "SummaryDetails.qml"
        }
    ]
    Container {

        Container {

            preferredWidth: Infinity
            background: style.black
            TopBar {
                id: bar
                layoutProperties: StackLayoutProperties {
                    spaceQuota: -1
                }
            }
            layoutProperties: StackLayoutProperties {
                spaceQuota: -1
            }
        }
        NetworkActivity {
            id: progressIndicator
            
            horizontalAlignment: HorizontalAlignment.Fill
            verticalAlignment: VerticalAlignment.Fill
        }
        ListView {
            objectName: "customList"
            id: customList
           
            listItemComponents: [
                ListItemComponent {
                    
                    Container {
                        id:itemRoot
                        background: back.imagePaint
                        attachedObjects: [
                            ImagePaintDefinition {
                                id: back
                                imageSource: "asset:///images/background.amd"
                            }
                        ]
                        Container {
                            
                            leftPadding: 20
                            rightPadding: 20
                            layout: StackLayout {
                                orientation: LayoutOrientation.LeftToRight
                            }
                            Label {
                                text: "A/C Number"
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 2
                                }
                            } 
                            Label {
                                text: ListItemData.accountNumber
                                textStyle
                                {
                                    base: SystemDefaults.TextStyles.TitleText
                                
                                }
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 3
                                }
                            }
                        }
                        Container {
                            
                            leftPadding: 20
                            rightPadding: 20
                            layout: StackLayout {
                                orientation: LayoutOrientation.LeftToRight
                            }
                            Label {
                                text: "Account Type"
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 2
                                }
                            } 
                            Label {
                                text: ListItemData.type
                                textStyle
                                {
                                    base: SystemDefaults.TextStyles.TitleText
                                
                                }
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 3
                                }
                            }
                        }
                         
                        Container {
                            
                            leftPadding: 20
                            rightPadding: 20
                            bottomPadding: 20
                            layout: StackLayout {
                                orientation: LayoutOrientation.LeftToRight
                            }
                            Label {
                                text: "Account Balance"
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 2
                                }
                            } 
                            Label {
                                text: ListItemData.availableBalance
                                textStyle
                                {
                                    base: SystemDefaults.TextStyles.TitleText
                                
                                }
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 3
                                }
                            }
                        } 
                    }
                    
                    }     
            ]
           
        }
     

    }

}
}

 

 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: unable to get asset

At first glance this looks okay to me, are you sure that background.png is spelled correctly (I'll assume it's a typo in your post above) and both the amd and png file are in an images folder within the assets folder?


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: unable to get asset

yes it is

 

import bb.cascades 1.0

TabbedPane {
    showTabsOnActionBar: false
    id: tabPane
    Tab {

        title: "Summary"
        id: tab1
        onTriggered: {
            alkhaliji.invisible();
        }
        Summary {
	
	        }
	    
    }
    Tab {
        title: "Accounts"
        Page {
            id: page2
            attachedObjects: [
                Sheet {
                    id: mySheet2
                    content: Page {
                        Button {
                            text: "Close Sheet"
                            onClicked: mySheet2.close()
                        }
                    }
                }
            ]
            actions: [

                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Edit"
                },
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Save"
                },
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Save"
                    onTriggered: {
                        mySheet2.open();
                    }
                },
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Save"
                },
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Save"
                },
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Save"
                }
            ]
        }
    }
    Tab {
        title: "Deposits"
        Page {
            id: page3

            attachedObjects: [
                Sheet {
                    id: mySheet
                    content: Page {
                        Button {
                            text: "Close Sheet"
                            onClicked: mySheet.close()
                        }
                    }
                }
            ]
            actions: [
                ActionItem {
                    title: "Show Sheet"
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        mySheet.open();
                    }
                }
            ]
        }
    }
    Tab {
        title: "Loans"
    }
    Tab {
        title: "Payments"
    }
    Tab {
        title: "Standing Instructions"
    }
    Tab {
        title: "Settings"
    }
    Tab {
        title: "Logout"
        onTriggered: {
            alkhaliji.goToGuestMenu();
        }
    }
    attachedObjects: [
        Style {
            id: style
        }
    ]
}

 

I use summary.qml in this page

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: unable to get asset

Try a clean build.

 

If that doesn't work post a screenshot of your assets folder.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: unable to get asset

http://s17.postimg.org/co3r5bstb/Untitled.png

 

Tabs.qml

 

import bb.cascades 1.0

TabbedPane {
    showTabsOnActionBar: false
    id: tabPane
    Tab {

        title: "Summary"
        id: tab1
        onTriggered: {
            alkhaliji.invisible();
        }
        NavigationPane {
            id: summaryNavigationPane
            objectName: "summaryNavigationPane"
            onPopTransitionEnded: { page.destroy(); }
            Page{
                Summary {
                    
                }
                attachedObjects: [
                    ComponentDefinition {
                        id: summaryDetails
                        source: "SummaryDetails.qml"
                    }
                ]
            }

	    }
    }
    Tab {
        title: "Accounts"
        Page {
            id: page2
            attachedObjects: [
                Sheet {
                    id: mySheet2
                    content: Page {
                        Button {
                            text: "Close Sheet"
                            onClicked: mySheet2.close()
                        }
                    }
                }
            ]
            actions: [

                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Edit"
                },
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Save"
                },
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Save"
                    onTriggered: {
                        mySheet2.open();
                    }
                },
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Save"
                },
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Save"
                },
                ActionItem {
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    title: "Save"
                }
            ]
        }
    }
    Tab {
        title: "Deposits"
        Page {
            id: page3

            attachedObjects: [
                Sheet {
                    id: mySheet
                    content: Page {
                        Button {
                            text: "Close Sheet"
                            onClicked: mySheet.close()
                        }
                    }
                }
            ]
            actions: [
                ActionItem {
                    title: "Show Sheet"
                    ActionBar.placement: ActionBarPlacement.InOverflow
                    onTriggered: {
                        mySheet.open();
                    }
                }
            ]
        }
    }
    Tab {
        title: "Loans"
    }
    Tab {
        title: "Payments"
    }
    Tab {
        title: "Standing Instructions"
    }
    Tab {
        title: "Settings"
    }
    Tab {
        title: "Logout"
        onTriggered: {
            alkhaliji.goToGuestMenu();
        }
    }
    attachedObjects: [
        Style {
            id: style
        }
    ]
}

 

Summary.qml

 

import bb.cascades 1.0

    Container {
        Container {

            preferredWidth: Infinity
            background: style.black
            TopBar {
                id: bar
                layoutProperties: StackLayoutProperties {
                    spaceQuota: -1
                }
            }
            layoutProperties: StackLayoutProperties {
                spaceQuota: -1
            }
        }
        NetworkActivity {
            id: progressIndicator
            
            horizontalAlignment: HorizontalAlignment.Fill
            verticalAlignment: VerticalAlignment.Fill
        }
        ListView {
            objectName: "customList"
            id: customList

            listItemComponents: [
                ListItemComponent {
                    
                    Container {
                        id:itemRoot
                        background: imageBackground.imagePaint
                        attachedObjects: [
                            ImagePaintDefinition {
                                id: imageBackground
                                repeatPattern: RepeatPattern.XY
                                image: imageTracker.image
                            },
                            ImageTracker {
                                id: imageTracker
                                imageSource: "asset:///images/background.png"
                            }
                        ]
                        Container {
                            
                            leftPadding: 20
                            rightPadding: 20
                            layout: StackLayout {
                                orientation: LayoutOrientation.LeftToRight
                            }
                            Label {
                                text: "A/C Number"
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 2
                                }
                            } 
                            Label {
                                text: ListItemData.accountNumber
                                textStyle
                                {
                                    base: SystemDefaults.TextStyles.TitleText
                                
                                }
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 3
                                }
                            }
                        }
                        Container {
                            
                            leftPadding: 20
                            rightPadding: 20
                            layout: StackLayout {
                                orientation: LayoutOrientation.LeftToRight
                            }
                            Label {
                                text: "Account Type"
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 2
                                }
                            } 
                            Label {
                                text: ListItemData.type
                                textStyle
                                {
                                    base: SystemDefaults.TextStyles.TitleText
                                
                                }
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 3
                                }
                            }
                        }
                         
                        Container {
                            
                            leftPadding: 20
                            rightPadding: 20
                            bottomPadding: 20
                            layout: StackLayout {
                                orientation: LayoutOrientation.LeftToRight
                            }
                            Label {
                                text: "Account Balance"
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 2
                                }
                            } 
                            Label {
                                text: ListItemData.availableBalance
                                textStyle
                                {
                                    base: SystemDefaults.TextStyles.TitleText
                                
                                }
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 3
                                }
                            }
                        } 
                    }
                    
                    }     
            ]
            onTriggered: {
               
 
            }
        }

    }


 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: unable to get asset

[ Edited ]

Your meta data is specifying a sliced image I'm not sure you can mix and match sliced images with tiles.

 

I've just read the docs and no it's not, choose one or the other...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__imagepaint.html


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: unable to get asset

that has nothing to do with it

 

 

check what i did

 

I went on and created instead of summary.qml

another qml file AccountSummary.qml

 

import bb.cascades 1.0


Container {
    Container {
        
        preferredWidth: Infinity
        background: style.black
        TopBar {
            id: bar
            layoutProperties: StackLayoutProperties {
                spaceQuota: -1
            }
        }
        layoutProperties: StackLayoutProperties {
            spaceQuota: -1
        }
    }
    NetworkActivity {
        id: progressIndicator
        
        horizontalAlignment: HorizontalAlignment.Fill
        verticalAlignment: VerticalAlignment.Fill
    }
    ListView {
        objectName: "customList"
        id: customList
        
        listItemComponents: [
            ListItemComponent {
                
                Container {
                    id:itemRoot
                    background: imageBackground.imagePaint
                    attachedObjects: [
                        ImagePaintDefinition {
                            id: imageBackground
                            repeatPattern: RepeatPattern.XY
                            image: imageTracker.image
                        },
                        ImageTracker {
                            id: imageTracker
                            imageSource: "asset:///images/background.amd"
                        }
                    ]
                    Container {
                        
                        leftPadding: 20
                        rightPadding: 20
                        layout: StackLayout {
                            orientation: LayoutOrientation.LeftToRight
                        }
                        Label {
                            text: "A/C Number"
                            layoutProperties: StackLayoutProperties {
                                spaceQuota: 2
                            }
                        } 
                        Label {
                            text: ListItemData.accountNumber
                            textStyle
                            {
                                base: SystemDefaults.TextStyles.TitleText
                            
                            }
                            layoutProperties: StackLayoutProperties {
                                spaceQuota: 3
                            }
                        }
                    }
                    Container {
                        
                        leftPadding: 20
                        rightPadding: 20
                        layout: StackLayout {
                            orientation: LayoutOrientation.LeftToRight
                        }
                        Label {
                            text: "Account Type"
                            layoutProperties: StackLayoutProperties {
                                spaceQuota: 2
                            }
                        } 
                        Label {
                            text: ListItemData.type
                            textStyle
                            {
                                base: SystemDefaults.TextStyles.TitleText
                            
                            }
                            layoutProperties: StackLayoutProperties {
                                spaceQuota: 3
                            }
                        }
                    }
                    
                    Container {
                        
                        leftPadding: 20
                        rightPadding: 20
                        bottomPadding: 20
                        layout: StackLayout {
                            orientation: LayoutOrientation.LeftToRight
                        }
                        Label {
                            text: "Account Balance"
                            layoutProperties: StackLayoutProperties {
                                spaceQuota: 2
                            }
                        } 
                        Label {
                            text: ListItemData.availableBalance
                            textStyle
                            {
                                base: SystemDefaults.TextStyles.TitleText
                            
                            }
                            layoutProperties: StackLayoutProperties {
                                spaceQuota: 3
                            }
                        }
                    } 
                }
            
            }     
        ]
        onTriggered: {
         
        }
    }

}


 

same code nthg different..from summary.,qml

 

now instead of Summary {} in tabs.qml i did AccountSummary {}

 

What error i get?

bb::cascades::QmlDocument: error when loading QML from:   QUrl( "asset:///Tabs.qml" )  
--- errors:  (asset:///Tabs.qml:18:17: AccountSummary is not a type)
bb::cascades::QmlDocument:createRootObject document is not loaded or has errors, can't create root

 

when i do vice i dont get it

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: unable to get asset

[ Edited ]

It's very hard to follow along and help you if you keep changing the code after every response. Smiley Happy

 

That error means you either have not got that QML object in visible scope or that the QML format is incorrect.

 

In your case the error message indicates the latter, your AccountSummary QML Object is not correct.

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: unable to get asset

i am not changfing anything

i have same code in summary.qml and accountsummary.qml

but when i say summary{} inside my tabs..it work
when i say accountsummary i get that error..
its not even a typo
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: unable to get asset

Is momentics not giving any indication of warnings or errors in your AccountSummary qml file?

 

There is something not right either a formatting problem or an object you are trying to include is missing an import or somethinhg along those lines.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.