###itemUpdated notifies the view that an item has been updated. Flex says to the view ..you are stale now ...please update yourself with latest changes from the arraycollection....like a view.refresh()
###SetItemAt is replacing the dataItem in the ArrayCollection. Like when u manually edit the view....u may want to call the setItemAt to propagate the changes from the view to the arraycollection. I know this is automated but when u do validations u may want to put a logic wheather u want oldValue or newValue in the arraycollection . In such cases u may have to call arraycollection.setItemAt to manually update the arraycollection. --- In flexcoders@yahoogroups.com, "j_lentzz" <[EMAIL PROTECTED]> wrote: > > Ok. Thanks. Makes sense. > > John > --- In flexcoders@yahoogroups.com, "Alex Harui" <aharui@> wrote: > > > > 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" <jelentz@> 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 > > >