1 Reply Latest reply on Aug 13, 2009 8:22 PM by Gregory Lafrance

    dispatching an event in a chart's dataTipRenderer

    ammmir

      Hi,

       

      I have a ColumnChart that uses a custom dataTipRenderer. The data tip includes a button that the user can click for more details about a particular column. When I try to dispatch an event in the button's click method, dispatchEvent returns true, but the application hosting the chart never receives the event... it's as if the event magically disappears. Here are the relevant code sections:

       

      application:

      addEventListener("chartTipDetailsClick", onTipClick);

      ...

        <mx:ColumnChart id="chart"
            width="100%"
            height="100%"
            dataProvider="{chartData..data}"
            showDataTips="true"
            dataTipMode="single"
            dataTipRenderer="ChangeChartDataTip">
      
            <mx:series>
              <mx:ColumnSeries xField="@x" yField="@y"/>
            </mx:series>
        </mx:ColumnChart>
      
      

       

      data tip renderer:

       

      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
          width="250"
          height="100"
          implements="mx.core.IDataRenderer">
      
        <mx:Metadata>
          [Event(name="chartTipDetailsClick", type="flash.events.Event")]
        </mx:Metadata>
      
        <mx:Script>
          <![CDATA[
            ...
      
            private function onClick(event:Event):void {
              trace("dispatched? " + dispatchEvent(new Event("chartTipDetailsClick")) );
            }
          ]]>
        </mx:Script>
      
        <mx:Button label="Details..." click="onClick(event)"/>
      </mx:Canvas>
      
      

       

      Is this expected behavior? If so, what would be the recommended way to implement what I am looking for?

       

      Thanks.

       

      - Amir