After a tween/mc animation is completed, is it removed from the juggler automatically?
Is a tween/mc removed from a juggler(8 posts) (5 voices)
A tween is removed automatically, a MovieClip not. (That's because a tween is a one-time throwaway object, while a MovieClip may be restarted.)
If in doubt, just have a look at the "isComplete" property of a class. It is used by the juggler to determine if an object can be removed from it. Except for the tween, most classes simply return "false" in that method.
I understand that a tween is automatically removed upon complete as you describe.
I find one-time use to be simple, but often inefficient and recommend another solution. It should NOT be the default in my opinion, but I see in many cases your API defaults to be 'easy to use' rather than objective. I respect that. So at least make it optional.
For example, if I want to use a tween to move my character each time the key is pressed, ideally I would create the tween one time, then 'clear' it manually and issue a new moveTo() command can call start().
This change could a) replace current functionality or b) replace the current functionality - requiring the users to manually add to the juggler (like now) then call .start() then wait for complete and remove from the juggler. While a is good because it doesn't break current implementation, it otherwise is undesirable because having default implementation (auto-remove from juggler) is not objective - the API should not JUST do that in my opinion. It should be a setting. That is opinion.
While separate, this request could be coupled with a TweenEvent system. I posted about that too.
Hm ... I could add a "reset()" method to the tween, or make "currentTime" writable. the juggler would still remove the tween when it's finished, but nobody would stop you from resetting and reusing it!
I'm not sure what "currentTime" is. I'm new. but yeah "reset()" would solve my needs.
I added that to my TODO list and will add a reset method soon. Again, thanks for the suggestion!
Just a note on this probably dead topic, you have to re-attach any callbacks you had on the tween after you reset it.Posted 4 years ago #
This information needs to be added to the Tween class reference
Also tag it along with the fact that you can directly use juggler.tween also
Thanks for the sensible question and promptly adding the reset method.Posted 3 years ago #
You must log in to post.