First, please do not "hijack threads" by doing a reply and then changing the
subject line.  It confuses many threaded readers.  Always start a new
message unless you ar really replying.

 

Then, I think you will not be successful with the approach you are taking.
The list controls manipulate itemRenderers according to their own needs and
you will not be able to predict the instantiation/destruction of
itemRenderers objects.  ItemRenderers should not attempt to maintain any
data on their own, but should only render the underlying data item (hence
the name.)

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Brandon Krakowsky
Sent: Wednesday, October 21, 2009 3:56 PM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] ArrayCollection.setItemAt() triggering a new
instance of itemRenderer class

 

  


Hello all,

I'm using an array collection as a data provider for a list component with a
custom itemRenderer.  If I use arrayCollection.addItemAt(), a new instance
of the itemRenderer class is created.  If I use arrayCollection.setItemAt,
the current instance for that particular item is updated, meaning the data
property is set..  This all seems normal.

It seems that the first time I run setItemAt(), another instance of the
itemRender class is created in it's place, despite the index of the item not
changing.  (It's just an icon or text, etc.)  Every subsequent time I call
setItemAt(), the data property is updated without creating a new instance,
but the first time, it's as if I'm adding an item to the list in the same
location.

It breaks down as there are instance vars in the itemRenderer I'm depending
on.

Thanks,
Brandon

 



Reply via email to