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: 257
Registered: ‎01-08-2013
My Device: Z10 LE
My Carrier: SiMobil
Accepted Solution

Property variant removes animations?

Let's start at the beginning.

property variant images


I have my container where I add images to.


Container {
            id: drawContainer
            layout: AbsoluteLayout {


 from this..

    attachedObjects: [
        ComponentDefinition {
            id: imageDefinition
            content: ImageView {
                imageSource: "cute_cat102.jpg"
                preferredHeight: imageHeight
                preferredWidth: imageWidth
                animations: [
                    TranslateTransition {                        
                        toX: 400
                        duration: 1000


 I add images dynamically, like this

var imagesTmp = Array();
        for (var n = 0; n < 3 * numberOfTiles; n ++) {
            imagesTmp[n] = imageDefinition.createObject();
            imagesTmp[n].translationX = getX(n);
            imagesTmp[n].translationY = getY(n);
        images = imagesTmp;

So far so good. I can access any of these images, and move them if i use images[0].translationX.

However, animations are a problem! They work for imagesTmp but not for images!


imagesTmp[0].animations // [object Object]
imagesTmp[0].animations[0].play() // works

images[0].animations // QVariant(QDeclarativeListProperty<bb::cascades::AbstractAnimation>)
images[0].animations[0].play(); // TypeError: Result of expression 'images[0].animations[0]' [undefined] is not an object.


I would like to be able to be able play animations of images, but as you can see, it doesn't let me. What did I do wrong?

I need to have access to images outside of the function I create them in.


Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Property variant removes animations?

Please try if this works:

property list<ImageView> images

Andrey Fidrya, @zmeyc on twitter
Posts: 257
Registered: ‎01-08-2013
My Device: Z10 LE
My Carrier: SiMobil

Re: Property variant removes animations?

Thank you!

It's not too happy about

Type mismatch of value of the 'images' property. Expecting ImageView[] and found Array.

 But it works anyway!