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
Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

playing an animation attached to an imageview inside an object [details inside]

[ Edited ]

I'll keep this short.  I have a QML object that lives in it's own QML file.  Let's call it myObject.  Now, inside of myObject there are a few imageviews.  one imageview in particular has some animations associated with it.

 

I also have an active tab let's call it mySpecifcTab creates an instance of myObject inside of it.

 

 

Below is the code, but here is my question:

 

My question: how can i play an animation attached to an image view that lives inside myObject when myObject has been attached / inserted into a QML page

 

 

myObject.qml:

import bb.cascades 1.0

Container {

    property alias animateON: onAnimation
property alias imageOn: fml_imgCoilOn
// lots of other things here; they're not important ImageView { id: fml_imgCoilOn objectName: "img_coil_ON" visible: false imageSource: "asset:///images/coil_ON.png" scalingMethod: ScalingMethod.AspectFit animations: [ FadeTransition { id: onAnimation fromOpacity: 0.0 toOpacity: 1.0 duration: 500 }, FadeTransition { id: offAnimation fromOpacity: 1.0 toOpacity: 0.0 duration: 500 } ] } }// end of the absolute layout container

 

 

And inside one fo my tabs, i have this code:

 

mySpecifcTab.qml:

 

import bb.cascades 1.0


Container {

        
        // insert the myObject.qml object
        myObject {
            id: myObj
            onTouch: {
                console.log("TOUCHED!");
               
               
                
                /*
                DOES NOT WORK
                */
                //                console.log("Attempting to access transition directly through exposed property...");
                //                myObj.animateON.play();
                
                //                console.log("Attempting to access transition directly through array...");
                //                myObj.imageOn.animations[0].play();
                //
                
                /*
                WORKS
                */
                console.log("Setting image to ON/OFF");
                fml.fmlGlowImg.visible = !fml.fmlGlowImg.visible;


            }
        
        } // end of myObject object
        
    } 
    
    
   // rest of the file cut as it's not needed

 

Here's what shows up in the console:

 

TOUCHED
Setting image to ON/OFF

 

SO i know that the object is getting the TOUCH signal OK, and the image that is suposed to show up does infact show up!

 

 

Thoughts?  Thanks for your time!

- - - - - - - - - -
Highlighted
Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

Re: playing an animation attached to an imageview inside an object [details inside]

Seriously? 61 views and nobody has any idea?!
- - - - - - - - - -