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

Adobe AIR Development

Reply
Developer
billfoust
Posts: 382
Registered: ‎05-19-2008
My Device: BlackBerry Torch

Tweeners and orientation changes...

I will throw this out there, not to ask a question, but to just give a general warning to folks. I've discovered that my own application has this problem and suspect that others might as well..

 

If you are using tweeners in your application and handling an orientation change, you could have a big problem if that orientation change comes while a tweener is tweening. Fortunately, the tweener class has remove methods to cancel the tween, but it might still require some special coding to make them work right. 

 

I'm still not sure if I'm going to try to fix this or not, but it's something to think about.

 

Bill

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Tweeners and orientation changes...

You can also queue the orientation changes and let the tweener finish and then process the next orientation change in the queue (if one exists).  It all depends on what type of behavior you want the end user to experience and how long does it take to tween from one orientation to another.

Developer
billfoust
Posts: 382
Registered: ‎05-19-2008
My Device: BlackBerry Torch

Re: Tweeners and orientation changes...

Do you do this? Its not a bad idea actually. I'm assuming you'd have to start a thread which would wait for the tweeners to finish and then process the orientation change, or is there a better way that i'm missing?

 

I had figured that I would stop all tweens and try to recover from the unknown state. For me, this is somewhat of a problem because I tween objects off the screen and use the onComplete event to remove the item from the stage when the tween is done. Once the tween starts though, I let go of any other references so if I canceled the tween I would lose the object reference to remove it.

 

Bill

 

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Tweeners and orientation changes...

Not currently, but I plan to.

 

  • Receive the orientation events and place them in a queue (Array).
  • If the queue has something in it do nothing (length > 1)
  • If the recent item is the only thing in the queue (length=1) then process it by popping it off the list and send it to the function to do the tween orientation change.  Once the orientation change is done, check the queue again.  You might want to have a small delay between checks (~0.5 seconds).
  • It probably would not happen, but the orientation change being added to the queue, make certain it does not already exist for the first item already in the queue so you dont try to tween to the current orientation needlessly.