這是在創建對象數組時回收對象的正確,最有效的方法嗎?AS3 - 回收對象
package com {
public class CreateList extends MovieClip {
//this is the object I will be recycling
private var newProperty:PropertyRow;
//this is the array I will use to reference the objects
private var _theRows:Array = new Array();
public function CreateList() {
for (var i:uint = 0; i < 1000; i++) {
//null the object
newProperty = null;
//create a new instance of the object
newProperty = new PropertyRow();
//store a reference to the object before nulling it in the next for loop cycle.
_theRows.push(newProperty);
}
//null the last object that was created in the for loop
newProperty = null;
}
}
}