1 Reply Latest reply on Mar 26, 2010 10:19 AM by injpix

    'change' event

    hidarikani Level 2

      Flex chart documentation: 'When you select an item programmatically, no change event is dispatched.'

       

      I've extended the LineChart class to create a custom MyLineChart class.

      Inside of MyLineChart I select an item programmatically and manually dispatch the 'change' event:

       

       

      _mySeries.selectedItem = item; //select series item
      dispatchEvent(new ChartItemEvent(ChartItemEvent.CHANGE));
      

       

       

      The problem: the event is dispatched faster than Flex updates _mySeries.selectedIndex so I get the old value

       

      When is the right time to dispatch the event? Maybe in the commitProperties() method?

        • 1. Re: 'change' event
          injpix Level 3

          Hi, I am not familiar with Charting components in Flex, however if you can call validateNow() I am sure that will change the property in time.  Although that may be expensive to use, depends on your situation.

           

          I would think that there would be more then one event dispatched for a single action.  Perhaps you are listening to a early event, as you mentioned.   Try to listen for an event that is dispatched later in the component life-cycle.