1 Reply Latest reply on Jan 18, 2011 5:37 AM by Mike Battistella

    Manually trigger chartItem event

    Mike Battistella



      I want to trigger manually an event (suppose a ChartItemEvent.ITEM_MOUSE_MOVE would be best). My intention is to show a datatip for a point on a line series independently of the mouse's y-position. So I catch the general mouse move event from the diagramm and trigger the item event of the line chart, like this:


      private function mouseChartHandler(event:MouseEvent):void {
          var sensitiveRegion:Rectangle = new Rectangle( event.stageX-5, 0, 10, this.document.height);   
          var hitItems:Array = new Array();
          for each ( var chartItem:ChartItem in lineChart.getItemsInRegion( sensitiveRegion ) ) {
              if ( chartItem.element.name == "seriesMean" ) {
                 var item:LineSeriesItem = chartItem as LineSeriesItem;
                 var hitItem:HitData = new HitData( new Date().getMilliseconds()*Math.random(), 1, item.x, item.y, chartItem);
                 hitItems.push( hitItem );
          var itemEvent:ChartItemEvent = new ChartItemEvent(ChartItemEvent.ITEM_MOUSE_MOVE, hitItems, event, this.lineChart);
          lineChart.dispatchEvent( itemEvent ); 


      But nothing seems to happen. Anyone an idea?