I thought I understood this from other postings and Moock
reading, but I find I'm still not entirely clear on what stuff I
need to delete and what stuff is automagically deleted when I am
done with an object. So, here some situations.
1) Suppose I have a CustomClass with private vars of the
private var myNumber:Number;
private var myString:String;
private var myClip:MovieClip
private var myText:TextField
private var myArray:Array
private var myButton:Button
private var mySpecialClass:SpecialClass
a) suppose in the course of using an instance (myCCInstance)
of that CustomClass I assign values to myNumber and myString, I
assume when I delete myCCInstance the myNumber and myString will go
b) Now suppose for other types, I create new objects (i.e.
myText = someClip.createTextField(...);
myArray = new Array(1,2,3);
myClip = someClip.attachMovie(...);
mySpecialClass = new SpecialClass(...);
Will any of these be deleted when the myCCInstance is deleted
or do ALL of them need to be deleted by some destroy method I
write. If I need to delete stuff myself then.... to delete an
array, I would assume myArray.delete will do the trick. To delete
myClip, I assume I first need to use myClip.removeMovieClip and
then the myClip variable will get deleted with the myCCInstance. To
delete myText - I'm not sure what to do here. For mySpecialClass I
must write a destroy method which dumps its appropriate stuff out
and then I could have that method do a this.delete.
c) Suppose some of these refer to instances created at
authortime on the stage-
myText = textOnStage_txt
myClip = clipOStage_mc
myButton = buttonOnStage_btn
I assume the items on stage will stay there, but the
variables that reference these will be deleted automatically when
myCCInstance is deleted.
Is all this correct?
Part 2 of my question is for the case of callback or nested
functions like an xml loader. Here is some sample code I found on
the web. When this is all done, is the xml object gone?
Oh, one more example:
suppose I have a private var myText:TextField;
and then a method which whenever it is called will do
myText = someClip.createTextField;
Will I wind up with orphaned TextField objects from previous
times the method was called? (i.e. there are a bunch of TextField
instances that are no longer assigned to myText, but they are out
there in space someplace)