[Tweener] Tweener clip memory buildup?

Jason F. Mortara JFM at bluefang.com
Tue May 19 15:44:48 PDT 2009


I like the last one the best:

onComplete:avatarExitPopup.removeMovieClip

 

Perhaps creating the anonymous function every time (though it's only
roughly every 10 seconds) does create some overhead?

 

Thanks for the help.

 

jfm

 

________________________________

From: tweener-bounces at lists.caurinauebi.com
[mailto:tweener-bounces at lists.caurinauebi.com] On Behalf Of Zeh Fernando
Sent: Tuesday, May 19, 2009 5:18 PM
To: tweener at lists.caurinauebi.com
Subject: Re: [Tweener] Tweener clip memory buildup?

 

Not sure about the garbage collection issue, but normally, you'd do it
this way:

Tweener.addTween( avatarExitPopup, { _xscale:1, _yscale:1, _alpha:0,
time:.3, delay:3, transition:"easeInOutCubic", onComplete:function() {
this.removeMovieClip(); } } );

Or with parameters:

var avatarExitPopup:MovieClip;
avatarExitPopup = etc....
Tweener.addTween( avatarExitPopup, { _xscale:1, _yscale:1, _alpha:0,
time:.3, delay:3, transition:"easeInOutCubic",
onComplete:function(target:MovieClip) { target.removeMovieClip(); },
onCompleteParams:[avatarExitPopup] } );

On the above example, you could have a separate function instead of
creating an anonymous function on every removal.

Or even, specifically for this case, because it takes no parameters:

Tweener.addTween( avatarExitPopup, { _xscale:1, _yscale:1, _alpha:0,
time:.3, delay:3, transition:"easeInOutCubic",
onComplete:avatarExitPopup.removeMovieClip } );

HTH,
Zeh

On Tue, May 19, 2009 at 6:06 PM, Jason F. Mortara <JFM at bluefang.com>
wrote:

 

I love Tweener!

 

I'm having some issues with performance slowdown over time of my
content. I've been trying to eliminate things one at a time, and now I'm
down to wondering if my use of Tweener will bypass Flash's garbage
collection. Performance is fine at first, but after say 10 or 20 minutes
things start to slow down visibly.

 

I've got these avatars, and when they go off line / disappear from the
gameworld, they leave a brief good-bye message behind. After 3 seconds
that message disappears.

 

function showAvatarExitPopup(av:MovieClip):Void

{

      trace("showAvatarExitPopup("+av+")");

      var avX:Number = av._x;

      var avY:Number = av._y;

      var avContainer:MovieClip = av._parent;

      var avatarExitPopup:MovieClip;

      

      avatarExitPopup = avContainer.attachMovie("avatarExitPopupMC",
"avatarExitPopup"+random(10000), avContainer.getNextHighestDepth(),
{_x:avX, _y:avY} );

      avatarExitPopup.alert_txt.text = "I'm out! See ya!"

      Tweener.addTween( avatarExitPopup, { _xscale:1, _yscale:1,
_alpha:0, time:.3, delay:3, transition:"easeInOutCubic",
onComplete:function() { avatarExitPopup.removeMovieClip(); } } );

}

 

Now... I wonder, usually I would expect the last inline function to work
normally. 

 

Tweener.addTween( avatarExitPopup, { _xscale:1, _yscale:1, _alpha:0,
time:.3, delay:3, transition:"easeInOutCubic", onComplete:function() {
avatarExitPopup.removeMovieClip(); } } );

 

But... because there is a 3 second delay on this function, perhaps by
the time it is called, the local var avatarExitPopup no longer exists as
a reference? And therefore using the reference's removeMovieClip method
won't work?

 

Any thoughts on reliably using removeMovieClip as an onComplete method
of Tweener?

 

Thanks!

 

 

jfm


_______________________________________________
Tweener mailing list
Tweener at lists.caurinauebi.com
http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.caurinauebi.com/pipermail/tweener-caurinauebi.com/attachments/20090519/f4e640bc/attachment.htm>


More information about the Tweener mailing list