It depends on how you coded the renderer.  Our list classes have very general 
and somewhat inefficient update strategies because we want to make sure most 
collection updates renderer correctly.  I haven't looked at how Spark List 
thinks, but mx:List will refresh all renderers even if only one item changes 
because it doesn't know if another renderer might have "look-ahead" and also 
care about the item even though its data item is some other item in the 
collection.

You might be better off suppressing the setItemAt if it is the same.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Baz
Sent: Monday, October 05, 2009 3:18 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] custom itemrender flicker



Hey Alex, thanks a lot for your reply. So it is *proper* behaviour that if you 
setItemAt in a custom itemrenderer that the whole control is rebuilt visually? 
Incidentally I am using Flex 4, so this might be of even more interest.

I have a SkinnableDataContainer with an ArrayCollection dataprovider that holds 
custom objects ('reports' in this case).

If my current collection has:

 1.  Report #1 = Name: 1stReportName, Path: 1stReportPath
 2.  Report #2 = Name: 2ndReportName, Path: 2ndReportPath
And then I do a myArrayCollection.setItemAt(Report1, 0), which basically sets 
the first item to the same report it currently has. The itemrenderer empties of 
all items, then re-displays them, causing a flicker or flash that is noticeable 
on a slow computer.

Wouldn't it make more sense for the itemrender NOT to re-build itself from 
scratch on every change? What if you had 100 items and u onl;y set one item?

Thanks a lot!

Baz




On Mon, Oct 5, 2009 at 3:05 PM, Alex Harui 
<aha...@adobe.com<mailto:aha...@adobe.com>> wrote:


It depends on how you wrote the renderer.  You can try overriding the "function 
set data()" to check for changes to the object referenced by the renderer, but 
then if some sub-property changes, the renderer will not update.



Might be better to understand why it flickers when updating.



Alex Harui

Flex SDK Developer

Adobe Systems Inc.<http://www.adobe.com/>

Blog: http://blogs.adobe.com/aharui



From: flexcoders@yahoogroups.com<mailto:flexcoders@yahoogroups.com> 
[mailto:flexcoders@yahoogroups.com<mailto:flexcoders@yahoogroups.com>] On 
Behalf Of Baz
Sent: Monday, October 05, 2009 12:32 PM
To: flexcoders@yahoogroups.com<mailto:flexcoders@yahoogroups.com>
Subject: [flexcoders] custom itemrender flicker





If I have a custom item render based on an ArrayCollection with 10 times, and 
just for fun, I loop through those 10 items and setItemAt the exact same values 
that are already there - on screen the list of items reloads in a sense, 
re-building itself to the exact same values. I would like that in such a case, 
the on-screen controls know that they are the same as before and not to rebuild 
themselves. Is this possible? Can I intercept some event to double check 
whether they are the same or different?

The goal of course, is to have this behaviour even if one some items changed. 
For example if I change only the 10th item, I would expect only the 10th item 
to refresh, no the whole collection.

Thanks for any ideas!

P.S. I am not useing refresh() on the ArrayCollection is it set to auto-update. 
Also, all my setItemAt calls are done in commitProperties()


Reply via email to