ArrayCollection is really a wrapper for an Array. You can access the "real" array in an ArrayCollection by using ".source". When you set the source property an event called "listChanged" is triggered. You can watch for this event and then do whatever you need.
So this
var newAC1:ArrayCollection = new ArrayCollection;
var newAC2:ArrayCollection = new ArrayCollection;
newAC1 = newAC2;
Is the same as this, but with an event trigger.
var newAC1:ArrayCollection = new ArrayCollection;
var newAC2:ArrayCollection = new ArrayCollection;
newAC1.addEventListener('listChanged', function(event:Event){trace('changed');});
newAC1.source = newAC2.source;
I think you'd bettrer to use CollectionEvent.COLLECTION_CHANGE
ReplyDeleteCOLLECTION_CHANGE only fires when you use the ArrayCollection methods like addItem. When you set the source of a ArrayCollection nothing happens. If you're adding/removing things to/from an ArrayCollection then I would say listen for COLLECTION_CHANGE.
ReplyDelete