As Jonathan points out, if you use the ArrayCollection API to modify the AC, then the correct events are dispatched. If you use lower level api's, like directly assigning a property aarray.push. those events are not dispatched.
Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Branam Sent: Thursday, June 26, 2008 2:15 PM To: [email protected] Subject: Re: [flexcoders] Repeater not repeating Tom, Sure. It is confusing. I think the concept of the AC being "updated" and "refreshed" is the problem. I'd like to help you understand, because it will prevent future frustration! Your quote: "I assumed (obviously incorrectly) that if the source of the AC was updated, and the contents of the AC refreshed (as was happening), the AC would dispatch some event that would alert bound objects (in this case, the Repeater) of the change." Specifically: "contents of the AC refreshed (as was happening)" The contents of the AC *is* the Array. So, when you change the Array, you are immediately changing the contents of the AC. There is no delay, no refresh, no update. It immediately changes and the AC immediately reflects those changes. If you do array.push("mydata") then ac.length it WILL be longer. And something like ac.getItemAt(ac.length-1) will immediately return "mydata". Therefore, if you inspect the AC's source in the debugger it will always be up-to-date. The AC doesn't make a copy and it never has stale data. However, the AC itself does not "know" that its data has changed. If you call ac.addItem("mydate") then the AC "knows" that its data has changed. Only when the AC knows its data has changed does it dispatch any events. When you change the contents of the Array that the AC uses as source, it has no idea you've made any changes. Thus, any components using the AC are also not alerted to any changes. So, if a different event were to cause the component to loop through the AC again, it would see the new data. The trick is finding an event that does this reliably and repeatably. The easiest solution is to use the AC directly to change the data. Manipulating the AC will always update components that listen to events on the AC. On Thu, Jun 26, 2008 at 1:43 PM, Tom McNeer <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: First, Amy, thanks for your suggestion. I had already done this, although it wasn't clear from my note. Jonathan, Thanks for your explanation, and for the solution. Calling refresh() correctly alerts the Repeater. What I guess I don't understand is that the ArrayCollection was always correctly being updated -- I could see the values in the debugger. But even though the Collection was updated, it wasn't informing the Repeater. I assumed (obviously incorrectly) that if the source of the AC was updated, and the contents of the AC refreshed (as was happening), the AC would dispatch some event that would alert bound objects (in this case, the Repeater) of the change. Clearly, I have a lot to learn about the way events propagate from various changes. -- Thanks, Tom Tom McNeer MediumCool http://www.mediumcool.com <http://www.mediumcool.com> 1735 Johnson Road NE Atlanta, GA 30306 404.589.0560

