1 Reply Latest reply on Jul 30, 2008 10:04 PM by jarinudom

    Assigning an array to a ListCollectionView

    jarinudom
      I have a ListCollectionView that I want to add a listener to so I can respond to changes, but the problem here is that I have to assign an array to it. When I do this:

      myListCollectionView = new ArrayCollection(myArray);

      It removes all listeners. Is there any other way to force an array into a ListCollectionView? When I do this:

      myListCollectionView = myArray as ArrayCollection;

      or

      myListCollectionView = ArrayCollection(myArray);

      I get an error.

      Alternately, is there an event I can listen to on a TileList that will let me know when the dataProvider has changed? I can't seem to find anything that works.

      P.S. Assigning a new ArrayCollection also seems to remove ChangeWatchers as well.
        • 1. Assigning an array to a ListCollectionView
          jarinudom Level 1
          Ok I ended up having to do this:

          myListCollectionView.disableAutoUpdate();
          myListCollectionView.removeAll();
          for each (var thing:Thing in thingArray) {
          myListCollectionView.addItem(thing);
          }
          myListCollectionView.enableAutoUpdate();

          and then hooking into the onUpdateComplete event (fires after the TileList redraws itself:

          myTileList.addEventListener("onUpdateComplete", myEventHandler);