Search Results

Search found 1 results on 1 pages for 'yman'.

Page 1/1 | 1 

  • How to keep track of objects for garbage collection

    - by Yman
    May I know what is the proper way to keep track of display objects created and hence allow me to remove it efficiently later, for garbage collection. For example: for(i=0; i<100; i++){ var dobj = new myClass(); //a sprite addChild(dobj); } From what i know, flash's garbage collection will only collect the objects without strong references and event listeners attached to it. Since the var dobj is strongly referenced to the new object created, I will have to "nullify" it too, am I correct? Should I create an array to keep track of all the objects created in the loop such as: var objectList:Array = new Array(); for(i=0; i<100; i++) { var dobj = new myClass(); //a sprite addChild(dobj); objectList.push(dobj); } //remove all children for each (var key in objectList) { removeChild(key as myClass); } Does this allow GC to collect it on sweep?

    Read the article

1