Objects are all passed by reference, I want to pass a weak reference
back to callers who request items from the cache, much like the
internal implementation must do in some way when
addEventListener(...true) as a weak reference.
For example:
public function getItem( id:String ):Item
{
var item:Item = getItemFromCache(id);
return new WeakReference( item );
}
So that anyone who has obtained an item from cache will not prevent
the object from being garbage collected.
Thanks,
Greg
On Tue, Feb 3, 2009 at 12:33 PM, Alan K <[email protected]> wrote:
> I don't understand. Event pointers can be instanciated as weak. Do you
> mean an object with a weak reference to another?
>
> e.g
>
> var foo:Object = 'First';
> var bar:Object = foo;
>
> // destroy object foo
> // foo still exists because of object bar
>
> Alan
>
>>However, I cant seem to find any way to instantiate a weak reference,
>>how can I do this in ActionScript?
>
>