AFAIK, any instances will remain in memory if there is a reference to it
anywhere. Even if you call the remove methods, they just remove them from
the Stage/screen but not from the memory stack. You will have to remove any
references in any instances in order to garbage collect them properly.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of geng wang
Sent: Monday, April 09, 2007 10:51 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] would this bother you?

hello flashcoders,

i have two fundamental questions. they somewhat keep bothering me:

1. what are the datatypes of a MovieClip instance and a Textfield
instance after calling "removeMovieClip()"/"removeTextField()" on that
MovieClip/Textfield instance?

2. do they remain in the memory after
"removeMovieClip()"/"removeTextField()"? do i need to "delete" the
references to them in order to have them "garbage collected"?

pls see below:

var tn:MovieClip = this.createEmptyMovieClip("tn", 0);
var tn_nested:MovieClip = tn.createEmptyMovieClip("tnNested", 0);
var tf_nested:TextField = tn.createTextField("tf", 1, 0, 100, 100, 100);
tf_nested.text = "hello world!";
tn.loadMovie("http://assets0.twitter.com/images/twitter.png?1175908827";);

destroy_btn.onRelease = function(){
        tf_nested.removeTextField();

        tn.removeMovieClip();
        
        trace("is tn instanceof MovieClip after removeMovieClip: "+(tn
instanceof MovieClip));//false
        trace("is tn instanceof Object after removeMovieClip: "+(tn
instanceof Object));//false
        trace("tn type after removeMovieClip: "+ typeof(tn));//movieclip
        trace("is tf_nested instanceof Object after removeMovieClip:
"+(tf_nested instanceof Object));//false
        trace("tf_nested type after removeMovieClip:
"+(typeof(tf_nested)));//movieclip
        trace("tn is "+tn+"; tf_nested is "+tf_nested);//tn is ; tf_nested
is

        delete tf_nested;
        delete tn;

        trace(newline+">>>>delete tn>>>>");
        trace("tn after destroy: "+(tn instanceof MovieClip));
        trace("tn after destroy: "+(tn instanceof Object));
        trace("tn type after destroy: "+ typeof(tn));
        trace("tf_nested type after destroy: "+(typeof(tf_nested)));
}
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to