--- In flexcoders@yahoogroups.com, "Josh McDonald" <[EMAIL PROTECTED]> wrote:
>
> When you do this:
> 
>   var date:Date = new Date();
> 
> You're creating an instance of Date and a reference to it 
named "date".
> 
> When you do this:
> 
>   var ref:Date = arr[0] as Date;
> 
> You're creating another reference to the same instance, this time 
your
> reference is named "ref". So when you set ref = null, you're 
making "ref"
> point to nothing. "date" and "arr[0]" remain unchanged. You don't 
need to,
> nor can you remove the date instance created above. That's the job 
of the
> garbage collector.

I always make sure I point references to null before I use them 
again.  If you couldn't do this, it would make looping through and 
adding dates and other objects that work like this very painful, 
because you'd have to create the date directly in the push or addItem 
statement.  Otherwise, you wind up with an Array or ArrayCollection 
all full of the same item.

-Amy

Reply via email to