Rocco Posted April 22, 2014 Share Posted April 22, 2014 while(tween.isRunning) { }i want to be sure that the tweening is over and then continue with the next lines in the function.is it possible somehow? i'm aware of tween.onComplete, but i don't want to use it this time, cause this is in a function who calls themself in some circumstances and calling another function with onComplete gives me a lot of trouble and unexpected behavior in my current situation. Link to comment Share on other sites More sharing options...
Pedro Alpera Posted April 22, 2014 Share Posted April 22, 2014 Could you share some code? Link to comment Share on other sites More sharing options...
Jorasso Posted April 22, 2014 Share Posted April 22, 2014 It is not possible in the way you try to do it. Your code doesn't give tween any chance to be updated, so isRunning flag will stay true forever. Try something with onComplete function. For sure you can get to some craft solution with it:) Rocco 1 Link to comment Share on other sites More sharing options...
george Posted April 22, 2014 Share Posted April 22, 2014 Hey Rocco,Jorasso is right. This is an endless loop. You can't do this in javascript. If somebody do this they do not have an understanding for the language, maybe you should work on it to make your life easier! With this being said you should really try the solution with onComplete, there are dozens and dozens of people who use it and I can assure you it is working as expected and you should really, really think about your code instead of avoiding the onComplete signal. Don't be lazy Have fun! Rocco 1 Link to comment Share on other sites More sharing options...
Rocco Posted April 22, 2014 Author Share Posted April 22, 2014 thank you both, it works now with onComplete and i have gained more experience with javascript today.sorry if it was a dumb question, but i have a rather complex construct which was finally working perfekt after a lot of tweakingand then i inserted the tweenings somewhere in the middle and suddenly it was buggy like hell, because of the fact that the tweenings are not finished during the function is called again. Link to comment Share on other sites More sharing options...
Recommended Posts