4 Replies Latest reply on May 19, 2009 5:57 PM by tcflex

    How to know when series items gets changed in the bubble series

    tcflex Level 1

      Hi,

       

      I want to trace when the data inside the series data provoder gets changed. how ?

       

      Regards,

      Arjun.

        • 1. Re: How to know when series items gets changed in the bubble series
          Michael Borbor Level 4

          Arjun if you're using an ArrayCollection as your dataProvider, you can add an event listener for the collectionChange event.

          • 2. Re: How to know when series items gets changed in the bubble series
            tcflex Level 1

            yeah i was trying to do in the same way but i cant listen to the collection change event.

             

            is this the correct way to add "myseries.addEventListener(CollectionEvent.COLLECTION_CHANGE,mylistener)"..

             

            The above statement is not working properly.

            • 3. Re: How to know when series items gets changed in the bubble series
              Michael Borbor Level 4

              This works for me

               

              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
                   <mx:Script>
                        <![CDATA[
                             import mx.collections.ArrayCollection;
                             import mx.events.CollectionEvent;
              
                             [Bindable]
                             public var expenses:ArrayCollection = new ArrayCollection([
                                  {Month:"Jan", Profit:2000, Expenses:120, Amount:45},
                                  {Month:"Feb", Profit:1000, Expenses:200, Amount:60},
                                  {Month:"Mar", Profit:1500, Expenses:500, Amount:30}
                                  ]);
              
                             public var myArray:Array=[{Month:"Mar", Profit:1500, Expenses:500, Amount:30}];
              
                             private function init():void{
                                  expenses.addEventListener(CollectionEvent.COLLECTION_CHANGE,myFunction);
                             }
              
                             private function myFunction(e:CollectionEvent):void{
                                  trace("I was changed");
                             }
              
                        ]]>
                   </mx:Script>
              
                   <mx:Button label="add something" click="expenses.addItem(myArray)" />
              </mx:Application>
              
              • 4. Re: How to know when series items gets changed in the bubble series
                tcflex Level 1

                I have implemented my own collection interface which extends IList and ICollection interface.