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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Developer
p3pp3r
Posts: 157
Registered: ‎12-16-2010
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.
Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010

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
Please use plain text.
Developer
kdittyr
Posts: 278
Registered: ‎10-27-2010

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 :smileyhappy:

 

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.  :smileytongue:

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

Accepted PlayBook Applications:
HDB Converter -- Utilities/Calculators
Please use plain text.
Developer
jtegen
Posts: 6,156
Registered: ‎10-27-2010
My Carrier: AT&T

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} });

 

Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010

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 :smileyvery-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
Please use plain text.
Developer
p3pp3r
Posts: 157
Registered: ‎12-16-2010
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.
Please use plain text.
Developer
kdittyr
Posts: 278
Registered: ‎10-27-2010

Re: How to wait for transition to complete?

[ Edited ]

No problems :smileyhappy:  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. :smileyvery-happy:

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

Accepted PlayBook Applications:
HDB Converter -- Utilities/Calculators
Please use plain text.
Developer
p3pp3r
Posts: 157
Registered: ‎12-16-2010
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.
Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010

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 :smileywink:

 

@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
Please use plain text.