Destroy Flash Objects Completely

喜欢而已 提交于 2019-12-12 04:54:34

问题


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 ??


回答1:


Yes... sort of.

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.

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.




回答2:


It depends of what you have into the class you used, if it's a loaded class you have to unload it, if you have variable that hold reference to other DisplayObject you should null them, etc...



来源:https://stackoverflow.com/questions/2023058/destroy-flash-objects-completely

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!