[Tweener] Tweener clip memory buildup?
Zeh Fernando
zeh at zehfernando.com
Tue May 19 14:17:42 PDT 2009
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/34e06fdf/attachment.htm>
More information about the Tweener
mailing list