Hi Josh,
I've tracked my crash down to setting the listCollection. If I comment these two lines out:
listCollection = new ListCollection(items);
_list.dataProvider = _listCollection;
I don't get a crash so it seems I am not disposing of the _listCollection properly in the clearList() function.
I noticed there is a dispose(function) for the list collection. Should I be implementing that?
Thanks
private function transitionInCompleteHandler( event:Event ):void {
createList();
}
public function createList():void {
if (_list) {
clearList();
}
_items = new <GalleryListItem>[];
for(var i:int = 0; i < 30; i++) {
_items.push(new GalleryListItem(dataxxx));
}
trace("CREATING NEW LIST");
_list = new List();
_list.itemRendererFactory = function():IListItemRenderer {
_renderer = new DragDropItemRenderer();
_renderer.isLongPressEnabled = true;
return _renderer;
};
var _vl:VerticalLayout = new VerticalLayout();
_vl.hasVariableItemDimensions = true;
_vl.useVirtualLayout = false;
_list.layout = _vl;
_list.isSelectable = true;
_list.hasElasticEdges = true;
_list.addEventListener(FeathersEventType.RENDERER_ADD, rendererAdded);
_list.addEventListener(FeathersEventType.RENDERER_REMOVE, rendererRemoved);
_list.width = 600;
_list.height = 600;
_list.y = 80;
createListCollection();
}
private function createListCollection():void {
_listCollection = new ListCollection(_items);
_list.dataProvider = _listCollection;
addChildAt(_list,1);
}
private function clearList():void {
trace("clearList");
try{
_list.removeEventListener(starling.events.Event.UPDATE, list_updateHandler);
_pullView.removeEventListener(FeathersEventType.PULLING, pullView_pullingHandler);
} catch (e:Error) {
trace("pidlist clearlist 1",e);
}
try{
_items.length = 0;
} catch (e:Error) {
trace("pidlist clearlist 2",e);
}
try{
_items = null;
} catch (e:Error) {
trace("pidlist clearlist 3",e);
}
try{
_list.dataProvider = null;
_listCollection = null;
} catch (e:Error) {
trace("pidlist clearlist 4",e);
}
try{
removeChild(_list, true);
} catch (e:Error) {
trace("pidlist clearlist 5",e);
}
try{
_list = null;
} catch (e:Error) {
trace("pidlist clearlist 6",e);
}
}