As you loop over the objects you can save them in an array instead of
in the collection.  When the array is finished being populated you can
set it to be the source on the collection.  That would result in only
one collection change event.

--- In [email protected], "Richard Baker" <[EMAIL PROTECTED]> wrote:
>
> Ahh, yes, that does work. I was looping as you suggest, but the
> collection change event was firing each time. Now that I think about
> it I suppose the best ting to do would be to hook up the event
> listener on the last addition to the ac? Or is there a better practice
> out there somewhere?
> 
> --- In [email protected], "Michael VanDaniker" <michael@>
> wrote:
> >
> > I haven't run this code, but I don't see why it wouldn't work:
> > 
> > this.source = event.result.source;
> > 
> > I personally prefer looping through the returned collection and
> > translating the raw objects into instances of a class I've defined. 
> > This allows for compile-time checking on anything you want to do with
> > the local copies, and it lets you add methods and properties to those
> > objects.
> > 
> > var o:SomeClass = new SomeClass(event.result[i]);
> > collection.addItem(o);
> > 
> > --- In [email protected], "Richard Baker" <bishbash64@>
wrote:
> > >
> > > I have a .as class extending arraycollection.
> > > 
> > > In the constructor I set up a webservice and listner to capture the
> > > result in resultHandler
> > > 
> > > Ideally in resultHandler I'd do something like
> > >   this=event.result;
> > > 
> > > but it doesn't work, so I am looping over the event.result,
adding it
> > > to the array collection like:
> > > 
> > >    this.addItem(event.result[i]);
> > > 
> > > can I assign the whole array collection in one go. Probably missing
> > > something simple, but I just can't see it :(
> > > 
> > > Thx
> > >
> >
>


Reply via email to