Say I have a class - assume everything is bindable for the sake of my typing
in gmail ;-)

class MyObj {
  name : String;
  id : Number;
  address : Address;
}

I make an ArrayCollection "myCollection" containing a bunch of MyObjs.

var tmp : MyObj = MyObj(myCollection.getItemAt(7));

tmp.name = "Blue"; //Should generates event
tmp.address = new Address("123 Fake St"); //Also should generate event

tmp.address.postCode = 5432; //Should not.

Say I add the instance myFoo to an ArrayCollection:

myCollection.add(myFoo);

Inside CollectionView, the following happens (more or less, not real
variable / class names, and I can't remember the order off the top of my
head):

1. Add foo to the internal storage
2. Is foo an IEventDispatcher? If not, goto 4
3. foo.addEventListener(PropertyChangeEvent, itemChangedHandler)
4. this.dispatchEvent(CollectionEventKind.ADD)

Now the default behaviour for objects is to dispatch PropertyChangedEvents
only when the actual value of their fields is updated. When you call:

tmp.address.postcode = 7654;

Address will dispatch a PropertyChangedEvent, but tmp will not. The end
result of this is that the collection doesn't know about the change.

In your case, you're adding myOtherArr to myArr. When you change something
inside myOtherArr, it dispatches a CollectionEvent, but not a
PropertyChangeEvent. And since CollectionView is only listening to
PropertChange and not CollectionEvent on the objects that it's watching, it
never knows about the change.

You might get notified when you add or delete something in myOtherArr,
because it probably dispatches a PropertyChangeEvent for myOtherArr.length.
But don't quote me on that ;-)

Hope that helps! I only know because I spent a lot of time in
CollectionView.as a week or so ago building an indexer for lists :)

-Josh

On Fri, Jun 20, 2008 at 6:08 AM, Durres76 <[EMAIL PROTECTED]> wrote:

> Hi,
> collectionEventKind.Update does not seem to fire when subitems within
> a collection change, i.e..
> myArr = new ArrayCollection();
> myOtherArr = new ArrayCollection();
> myArr.addItem(myOtherArr);
>
> the update event does not fire if myOtherArr changes. it does if myArr
> changes.
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>


-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to