This content has been marked as final. Show 10 replies
what do you mean by, "...the objects have members..."? the objects contain references to the members?
The objects stored in the dict have properties, one is a Sprite which was is added to the display list.
I thought by way of the sweep garbage collection the objects in the dict wouldn't be collected if one of their members is a Sprite on the display list. Its no biggie just curious really, as it didn't work as I expected. Removing the weak-references of course solved the problem.
the object is a dictionary key and the sprite is gc'd? what makes you think the object is gc'd?
Yup. It's like this.
var dict:Dictionary = new Dictionary(true);
var myParentObj:Object = new Object;
myParentObj.child = new Sprite();
dict[myParentObj] = true;
The Sprite isn't gc'd (as far as I can tell) because I continue to see it graphically represented onscreen. The myParent.child animation terminates, but the ENTER_FRAME doesn't. I think the ParentObj is gc'd because if I don't use weak-references with the dictionary, the animation doesn't terminate, and the child object wouldn't still be visible onstage, right?
to what object is the enterframe event attached?
another object which holds all of the above methods/members and is added to the display list
and that enterframe loop continues to execute after child is removed?
Thats correct, except child doesn't seem to "remove", it's DIsplayObject remains on screen. Which leads me to believe that it's parent, which is the dictionary key, is gc'd.
could you post a link to a fla that demonstrates this issue?