破坏Flash对象完全对象、Flash

2023-09-09 21:32:00 作者:笑我孤陌

当我毁了我的对象是在舞台上。我通常只是removeChild之(本),并删除了对象的事件侦听器。这一切,我需要做彻底删除对象??

When I destroy my objects that are on the stage. I usually just removeChild(this) and I remove event listeners of the object. is this all I need to do to completely remove the object ??

推荐答案

是的......之类的。

Yes... sort of.

在AS3中,你不能破坏的对象。所有你能做的就是删除所有对它们的引用,这使得它们可进行垃圾回收。下一次GC是跑了,就会破坏他们的如果他们都可用。这是一个pretty的大课题,但基本上,永远记得删除所有引用,你会走在正确的方向。

In AS3 you can not destroy objects. All you can do is remove all references to them, which makes them available for garbage collection. The next time the GC is ran, it will destroy them if they are available. It's a pretty big subject, but basically, always remember to remove all references and you will be going in the right direction.

请记住同样,code仍然可以在可用的GC,有点奇物执行的,但重要的是要注意的。

Keep in mind also, that code can still be executed in objects that are available for GC, sort of odd, but it is important to note.