Hi
I have strange problem. I remove sprite object from container and its not visible anymore but still behaves like its existing.
here is how i add object to container:
var index:uint = worktops.objects.length;
if (index==0) index++;
worktops.objects[index] = new Sprite();
worktops.createObject(worktops.objects[index], index, iUI.inputData[2]*scale, iUI.inputData[3]*scale);
can.worktopLayer.addChild(worktops.objects[index]);
and here is how i remove it:
for( var j:uint = 0; j < objects[selectedIdx].numChildren; j++){
objects[selectedIdx].removeChildAt(j)
}
**trace("child?",objects[selectedIdx].getChildAt(0).parent.name)**;
objects[selectedIdx].removeEventListener(MouseEvent.MOUSE_UP,checkTarget);
objects[selectedIdx].removeEventListener(MouseEvent.MOUSE_MOVE,moveObject);
objects[selectedIdx].removeEventListener(MouseEvent.CLICK, objectClicked);
objects[selectedIdx].removeEventListener(MouseEvent.MOUSE_DOWN, startMoveObject);
objects[selectedIdx].filters = [];
objects[selectedIdx].parent.removeChild(objects[selectedIdx]);
Strange thing is that after removing child (embeded text)from object the child still has a parent (bolded part of code). Why is it like this?
I think that all listeners and vars has been removed from the object but probably not because GC does not remove the object comepletly. Why object is still at its place ? Is there easy way to check what has to be removed from object so GC can collect it?
PS Putting null,undefined or deleting object does not solve problem here.