movieclip isn't private dictionary
i have collection where i reason information movieclips, i wish information rubbish collected i stop controlling movieclips. i'm controlling noxious keys parameters, works ideally data, however i've run problem.
this formula works great:
var mc = new movieclip();
var dic = new dictionary(true);
dic[mc] = 12;
mc = null;
system.gc();
system.gc();
for (var obj dic)
trace(obj); //this doesn't execute
but i indeed movieclip, stops working:
var mc = new movieclip();
var dic = new dictionary(true);
dic[mc] = 12;
addchild(mc);
removechild(mc);
mc = null;
system.gc();
system.gc();
for (var obj dic)
trace(obj); //this prints [object movieclip]
why does happen? something i'm doing wrong? there workaround?
edit: i know specific instance i delete dic[mc]
, nonetheless impetus simplified case. general, i don't wish manually have mislay movieclip dictionary, nonetheless should involuntary i don't anxiety anymore rest application.
edit2: i attempted contrast aaron said, came adult only uncanny stuff... only iterating collection (without doing anything) changes behaviour:
var mc = new movieclip();
var dic = new dictionary(true);
dic[mc] = 12;
addchild(mc);
removechild(mc);
mc = null;
for (var objeto dic) {} // <-- try commenting out line
addeventlistener('enterframe', f); // i imitation essence each frame, if
// gets private after awhile
function f(evento)
{
system.gc();
system.gc();
(var objeto dic)
trace(objeto);
}
this keeps duplicate [object movieclip] each frame, unless i critique out indicated line, where doesn't imitation anything.
Comments
Post a Comment