创建对对象的弱引用 [英] Create a weak reference to an object

查看:33
本文介绍了创建对对象的弱引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Actionscript 3 中创建对对象的弱引用,以便可以对其进行垃圾回收.

Is it possible in Actionscript 3 to create a weak reference to an object, so that it can be garbage collected.

我正在创建一些类以使调试更容易,所以我不希望对象在内存中徘徊,如果它们只在此处被引用(当然我不想用回调填充代码以删除对象)

I'm creating some classes to make debugging easier, so I don't want the objects to hang around in memory if they are only referenced here (and of course I don't want to fill the code with callbacks to remove the objects)

推荐答案

Grant Skinner 在 ActionScript 3 中的资源管理,在该系列的第三部分中,他介绍了 WeakReference 和 WeakProxyReference 可用于此目的的辅助类.

Grant Skinner has written an excellent series of articles on resource management in ActionScript 3, and in the third part of that series he introduces the WeakReference and the WeakProxyReference helper classes that can be used for this.

这篇关于创建对对象的弱引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆