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
Regular Contributor
Posts: 70
Registered: ‎09-06-2012
My Device: Developer
My Carrier: Bell Mobility

Play animation (RotateTransition) as required

I have a button when clicked (onClicked) invokes the play() function for an animation. This worked perfectly except only once. When I click on the button a second time or more nothing happens. Button visibly appears to receive focus ok  (although I guess with a touch screen you don't really need to set focus).

 

I cannot find any documentation that says OnClicked only works once or once an animation has stopped it can not be played again.

 

What am I missing - either in my code or in my understanding?

Developer
Posts: 222
Registered: ‎11-05-2011
My Device: Z10
My Carrier: Beeline

Re: Play animation (RotateTransition) as required

I'm also found that and search for solution.

Regular Contributor
Posts: 70
Registered: ‎09-06-2012
My Device: Developer
My Carrier: Bell Mobility

Re: Play animation (RotateTransition) as required

I'm thinking that once a transition has occurred you cannot redo that transition unil you return to the original state. However,  I have no idea how to do that.

 

In my case, I just happen to be back where I started from but cascades doesn't know that!

 

I added a reverse transition to get me back to my orignal state (which is where I was anyways).

 

Now, as far as I can tell it does both transitions forward and back. Ignores the first click. Then, does the transitions back and forward. It happens so fast I am not really sure that it does them in reverse. But its so funny I can't stop laughing. I will change some properties to slow down the transition.

 

Meanwhile, how do I restore the original state. Reload the image? Save some properties and restore them?

Regular Contributor
Posts: 70
Registered: ‎09-06-2012
My Device: Developer
My Carrier: Bell Mobility

Re: Play animation (RotateTransition) as required

I found a removeAnimation or removeAllAnimations that seems to work. I added a second button to do the reset and as soon as I did that the first button worked as expected(?) without doing the remove animations.