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: 224
Registered: ‎03-29-2012
My Device: 9900
My Carrier: Wind
Accepted Solution

CustomControl background change

Hello everyone, I made a customcontrol in QML that has a background image and text overtop. What I want to do is fade out the background and fade in a new image. I know I can use a fadeTransition animation to fade it in our out but I am unsure how to just access the image of the customcontrol rather than animate itself in its entirety. I know properties can be defined in the customcontrol.qml file, but is it possible to just animate a part of the control? My alternative is to make two different controls with each different image and fade  one out and the other in. 

 

so far I create a instance of the customcontrol like this:

 MusicButton {
      id: music
      opacity:0
          animations: [
              FadeTransition {
                  id:fade
                   duration:1000
                   easingCurve: StockCurve.CubicOut
                   fromOpacity: 0
                   toOpacity: 1
               }
           ]
                layoutProperties: AbsoluteLayoutProperties {
                                    positionX: 145
                                    positionY: 325
                                }
                                onTouch: {
                                    if (event.isDown)
                                        fadeIn(); 
                                }
                                    
            }

 

 

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: CustomControl background change

I have not played with animations much, but the documentation suggests that the property target should do the trick:

https://developer.blackberry.com/cascades/reference/bb__cascades__abstractanimation.html#target

 

Stuart

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: CustomControl background change

Did this do the trick?  (If so, please accept the solution)

Or are you still stuck?

If you solved it some other way, please follow up with the solution.

 

Stuart

Developer
Posts: 224
Registered: ‎03-29-2012
My Device: 9900
My Carrier: Wind

Re: CustomControl background change

My apologies, I must have missed the reply, I am out currently but will test it and get back asap
Developer
Posts: 224
Registered: ‎03-29-2012
My Device: 9900
My Carrier: Wind

Re: CustomControl background change

Your solution was appropriate, thank you for showing it and reminding me of it Smiley Happy