itemUpdated implies you changed properties of some item.  setItemAt
implies you replaced that instance with another instance.  Things like
selection will be abandoned.

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of syndicate_ai
Sent: Wednesday, November 28, 2007 12:51 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Differences between itemUpdated and setItemAt
for ArrayCollections



--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "j_lentzz" <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> I have a general question about when to use the two methods
> itemUpdated and setItemAt on ArrayCollections.
> 
> if you use obj = getItemAt(someIndex) and then change some properties
> in the obj, what difference is there between using
> setItemAt(obj,someIndex) or using itemUpdated(obj)? Is there a
> particular reason to choose one over the other?
> 
> Thanks,
> 
> John
>

you generally use setItemAt if you need to completly replace the
object in that part of the arraycollection. For instance, we have a
backend delegate class that instantiates new objects all the time,
each being different but needs to replace the item that already exists
in the collection (each object being replaced is progressivly more
lightweight) so SetItemAt is necessary for us, its more costly because
the view has to completly rerender for that item. getItemAt would be
better if you are just changing a few attributes on the object,
because a view only needs to change if certain attributes are
different from before.

Thants what i think anyway



 

Reply via email to