  | |  | memory management - removeMovieClip / | memory management - removeMovieClip /
2004-02-24 - By Cédric de Crozant
Back afaik, this short example shows that :
- we should delete mc references variables after removeMovieClip() to avoid
holding broken ref vars in mem.
- (ref==undefined) won 't work if we don 't delete the ref manually after
removeMovieClip()
- removeMovieClip() correctly deletes onEnterFrame events affected to an
instance.
trace( "##START ");
trace( "_global.myRef_mc= "+typeof _global.myRef_mc);
trace( "onEnterFrame= "+typeof _global.myRef_mc.onEnterFrame);
//
_global.myRef_mc=this.createEmptyMovieClip( "my_mc ",10);
trace( "##CLIP CREATED ");
_global.myRef_mc.onEnterFrame=function(){};
trace( "_global.myRef_mc= "+typeof _global.myRef_mc);
trace( "onEnterFrame= "+typeof _global.myRef_mc.onEnterFrame);
//
_global.myRef_mc.removeMovieClip();
trace( "##CLIP REMOVED ");
trace( "_global.myRef_mc= "+typeof _global.myRef_mc);
trace( "onEnterFrame= "+typeof _global.myRef_mc.onEnterFrame);
//
delete _global.myRef_mc;
trace( "##REF DELETED ");
trace( "_global.myRef_mc= "+typeof _global.myRef_mc);
trace( "onEnterFrame= "+typeof _global.myRef_mc.onEnterFrame);
cedric.
-- -- Original Message -- --
From: "ryanm " <ryanm@(protected) >
To: <flashcoders@(protected) >
Sent: Monday, February 23, 2004 1:27 PM
Subject: Re: [Flashcoders] memory management - removeMovieClip /
> > If m has some event associated like onEnterFrame I delete the
> > handler BEFORE deleting my instance like:
> >
> > delete m.onEnterFrame;
> > delete m;
> >
> I believe that removeMovieClip cleans everything up for you. Of course
> it only works for movie clips, but it should clean up any events or
> properties attached to the clip.
>
> ryanm
>
>
> =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
> Supported by Fig Leaf Software
> =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
> Be sure to check the archives and the wiki:
> http://chattyfig.figleaf.com/
> =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
> http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104961
> =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
> To unsubscribe send a blank e-mail to:
> Normal Mode: flashcoders-unsubscribe@(protected)
> Digest Mode: flashcoders-digest-unsubscrive@(protected)
>
>
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:105024
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|
 |