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
Posts: 157
Registered: ‎12-16-2010
My Device: Torch 9800, PlayBook
My Carrier: I carry it myself
Accepted Solution

How to wait for transition to complete?

I am using Tweener.AddTween() to apply some transitions to my sprites which take say quarter of a second. After transition is completed I need to do something else. The problem is the line immediately following the transition is executed right away (does not wait for the transition to complete) and messes everything up. Is there a way to somehow synchronously wait until the transition complete without tying up CPU in a loop, etc?

----------
If you find this post helpful please "like" it and accept as a solution.
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: How to wait for transition to complete?

hey p3pp3r,

 

there is a parameter for the caurina tweener call "onComplete" that performs a function after it is completed. it goes right into the addTween method.

 

Here is more detail about the onComplete parameter (along with several other useful ones):

 

http://hosted.zeh.com.br/tweener/docs/en-us/parameters/index.html

 

example:

 

 

Tweener.addTween(myobj, {x: 45, onComplete: myFunction});

 

hope that helps. good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 278
Registered: ‎10-27-2010
My Device: Playbook

Re: How to wait for transition to complete?

[ Edited ]

 


p3pp3r wrote:

I am using Tweener.AddTween() to apply some transitions to my sprites which take say quarter of a second. After transition is completed I need to do something else. 


 

You will need to add onComplete 

http://hosted.zeh.com.br/tweener/docs/en-us/parameters/onComplete.html

 

If you need to pass parameters just add onCompleteParams

http://hosted.zeh.com.br/tweener/docs/en-us/parameters/onCompleteParams.html

 

I know I am passing you off to the documentation, but I wanted to get in before JRab Smiley Happy

 

EDIT:  YOU HAVE GOT TO BE KIDDING ME!!!  I couldn't have planned that any better...  The above sentence ( now bold ) was in my original reply and of course once I submitted I conveniently noticed that someone beat me to it.  Smiley Tongue

--------------
kdittyr

Accepted PlayBook Applications:
HDB Converter -- Utilities/Calculators
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to wait for transition to complete?

The function can also be inline:

 

Tweener.addTween(myobj, {x: 45, onComplete: function():void{myobj.visible=false} });

 

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: How to wait for transition to complete?

@kdittyr: man super sorry haha. i just saw your post and it made me lol so hard. you called it Smiley Very Happy

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 157
Registered: ‎12-16-2010
My Device: Torch 9800, PlayBook
My Carrier: I carry it myself

Re: How to wait for transition to complete?

wow, super thanks.. but now which reply do i tag as a solution? ;-) LOL

----------
If you find this post helpful please "like" it and accept as a solution.
Developer
Posts: 278
Registered: ‎10-27-2010
My Device: Playbook

Re: How to wait for transition to complete?

[ Edited ]

No problems Smiley Happy  I had a good laugh here, as well!

 


p3pp3r wrote:

wow, super thanks.. but now which reply do i tag as a solution? ;-) LOL


That is a quandary...  hmmm...  JRab was first with the answer. Smiley Very Happy

--------------
kdittyr

Accepted PlayBook Applications:
HDB Converter -- Utilities/Calculators
Developer
Posts: 157
Registered: ‎12-16-2010
My Device: Torch 9800, PlayBook
My Carrier: I carry it myself

Re: How to wait for transition to complete?

two kudos for you and accept for JRab since he beat you to it - i think its fair ;-) LOL

----------
If you find this post helpful please "like" it and accept as a solution.
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: How to wait for transition to complete?

@kdittyr: i think we're making it difficult for people to ask questions around here... we're an eager bunch Smiley Wink

 

@p3pp3r: looks like you put a lot of thought into this matter - sorry for the difficulty haha

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman