0 Replies Latest reply on Jun 22, 2007 9:17 AM by fuzzarooO

    arrayCollection's : collectionChange event

    fuzzarooO Level 1
      hi guys, in component B, i've got an addListener for a dataProvider's array collection and what I want to do is have an event occur as soon as the data in the provider changes.

      -Main App
      --Component A
      ---ComponentB
      --ComponentC

      I've got:

      <mx:Script>
      <![CDATA[
      import events.gridChangedEvent;
      import mx.collections.ArrayCollection;
      import mx.events.CollectionEvent;

      [Bindable] public var gridProvider:ArrayCollection = new ArrayCollection();

      private function onGridChanged(event:CollectionEvent):void {
      var myEventObj:gridChangedEvent = new gridChangedEvent("gridChanged", lineGrid, gridProvider);
      dispatchEvent(myEventObj);
      }

      private function init():void{
      gridProvider.addEventListener("collectionChange", onGridChanged);
      }
      ]]>
      </mx:Script>

      <mx:VBox x="0" y="0" height="100%" width="100%">
      <mx:HBox width="100%" height="47">

      <mx:DataGrid id = "lineGrid" sortableColumns="false" dataProvider="{gridProvider}" itemEditEnd="{onCellChanged();}" rowCount = "2" editable="true" creationComplete = "{init();}" >
      </mx:DataGrid>

      </mx:HBox>
      </mx:VBox>