01-07-2011 03:34 PM
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?
Solved! Go to Solution.
01-07-2011 03:41 PM
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/parame
example:
Tweener.addTween(myobj, {x: 45, onComplete: myFunction});
hope that helps. good luck!
01-07-2011 03:42 PM - edited 01-07-2011 03:44 PM
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/parame
If you need to pass parameters just add onCompleteParams
http://hosted.zeh.com.br/tweener/docs/en-us/parame
I know I am passing you off to the documentation, but I wanted to get in before JRab ![]()
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. ![]()
01-07-2011 03:47 PM
The function can also be inline:
Tweener.addTween(myobj, {x: 45, onComplete: function():void{myobj.visible=false} });
01-07-2011 03:53 PM
@kdittyr: man super sorry haha. i just saw your post and it made me lol so hard. you called it ![]()
01-07-2011 04:08 PM
wow, super thanks.. but now which reply do i tag as a solution? ;-) LOL
01-07-2011 04:19 PM - edited 01-07-2011 04:22 PM
No problems
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. ![]()
01-07-2011 06:23 PM
two kudos for you and accept for JRab since he beat you to it - i think its fair ;-) LOL
01-07-2011 06:26 PM
@kdittyr: i think we're making it difficult for people to ask questions around here... we're an eager bunch ![]()
@p3pp3r: looks like you put a lot of thought into this matter - sorry for the difficulty haha