Hi, I haven’t managed to find a huge amount of info on the AS3 garbage collector although gskinners blog has some good articles. My question really is this:
Will the garbage collector automatically free resources from an object’s members (assuming I have no references to them elsewhere and have removed all event listeners) once I remove the parent object from the stage and set its reference to null (as Java behaves)?
Or should I explicitly remove the member objects from my parent object and null them also?
ie.
public class A extends Sprite{
private var bInstance:B;
public function A() {
bInstance = new B();
this.addChild(bInstance);
}
//should I implement a function such as this or is it completely unnecessary?
public function destructor():void {
this.removeChild(bInstance);
bInstance = null;
}
}
Cheers,
Alex