if you find that your tweens sometimes don't finish, but sometimes they do, then the cause might be the automatic garbage collection. For instance if you're setting up the tween in a class method, and storing hte Tween in a local variable, or not storing it at all, then once that method finishes the garbage collector considers that tween to be done with and may well delete it - or not, sometimes.
So to prevent this from happening, store the tween in a class variable instead - that way it will always be in scope that the GC won't touch it, and it will be left alone to finish the tween.
i don't see how this could be the case for an object that's on the display list. I'm positive that garbage collection would ignore anything that is visible to the user until such times as it (or its parent) is removed from the stage.
it's certainly not what you expect to happen, but that's the way it seems to be - I found this out from other people's blogs and so on, so it's not just me.
I would definitely maintain that the problem lies with the particular Tween class being used and not the garbage collection of the stage items.
it's garbage collection of the tween I think that does it. e.g. here's my code that was having trouble:
private function showContentCloseButton():void {
var mcCloseContentButton:MovieClip = MovieClip(ldrCloseContentButton.content);
ldrCloseContentButton.visible = true;
if (mcCloseContentButton.getChildByName("closeButton")) {
mcCloseButton = MovieClip(mcCloseContentButton.getChildByName("closeButton"));
mcCloseButton.buttonMode = true;
mcCloseButton.addEventListener(MouseEvent.CLICK, handleCloseContentButtonClick);
mcCloseButton.x = (ldrContent.x + ldrContent.width) - mcCloseButton.width;
mcCloseButton.y = ldrContent.y - mcCloseButton.height;
// ======================
// Here's the Tween...
var tempTween:Tween = new Tween(mcCloseButton, "y", Elastic.easeOut, mcCloseButton.y + 40, mcCloseButton.y, 1.5, true);
// ======================
}
}
and to fix the problem I created a class property to store that Tween in, and it stopped canceling the tween - is there another explanation for my problem do you think?
here's a blog post about it:
as3-garbage-collection-the-reason-your-tweens-are-ending-early