The question is not how to add a listener, that was obviously the 
first thing I tried.

The problem is that the chart itself gets click events, not the 
annotations.
So when I add the listener you suggest to the annotation itself, it 
never fires.

So, either listen to the CLICK event on the chart and decifer if it 
is clicking on something specific within the chart, or find another 
way to listen on an annotation item.



--- In [email protected], "Tim Hoff" <[EMAIL PROTECTED]> wrote:
>
> 
> Just add an event listener to the label; before you push it to the
> array:
> 
> var annotations:Array = new Array();
> 
> var lbl:Label = new Label();
> lbl.text = "annotation";
> lbl.addEventListener(MouseEvent.CLICK,onAnnotationClick);
> annotations.push(lbl);
> myChart.annotationElements = annotations;
> 
> private function onAnnotationClick(event:MouseEvent) : void
> {
>          Alert.show("I got clicked");
> }
> 
> -TH
> 
> --- In [email protected], "blc187" <blc187@> wrote:
> >
> > Using annotations in a chart, creating a few labels and assigning 
them
> > to the annotation property of my line chart.
> >
> > var annotations:Array = new Array();
> > var lbl:Label = new Label();
> > lbl.text = "annotation";
> > annotations.push(lbl);
> > myChart.annotationElements = annotations;
> >
> > If I try to listen to mouse events on these annotations, they 
never
> > come through, maybe the chart is swallowing them?
> > I'd like to be able to add a CLICK listener to tell when I am 
clicking
> > on the annotation label.
> > Any thoughts on how to do this?
> >
>


Reply via email to