RE: [flexcoders] Two ChartElement extension classes that catch MouseDowns (Charting)

2007-01-16 Thread Ely Greenfield
 
 
 
You could have both of your extensions add the mouse down listener to
the parent chart.   You'd get a few false positives...mouse down on the
axes and titles, for example...but if you did some simple bounds
checking you could filter those out.
 
Ely.
 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of g_odds
Sent: Monday, January 15, 2007 2:43 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Two ChartElement extension classes that catch
MouseDowns (Charting)



I have created two classes that extend ChartElement, one for zooming
and one for panning. Both work as wanted if applied separately to a
chart using the annotationElements. However, if I apply both only one
of the two will ever catch a MouseDown rather than both. I worked out
how to implement the classes in the first place by looking at the
InteractiveBubble example on the Quietly Scheming website
(http://www.quietlyscheming.com/blog/charts/interactive-bubble-chart/
<http://www.quietlyscheming.com/blog/charts/interactive-bubble-chart/>
).

The jist is that I have overridden the updateDisplayList(..) function
with the following to ensure the Pan or Zoom catches the mouse event:

override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth,unscaledHeight);
graphics.clear();
graphics.moveTo(0,0);
graphics.beginFill(0,0);
graphics.drawRect(0,0,unscaledWidth,unscaledHeight);
}

Clearly the problem I am having when I have two classes using this
same technique being used at the same time is because one of the
"rectangles" is on top of the other.

I realise that combining the pan and zoom into a single class, as is
done in the Quietly Scheming example, would solve the problem but it
is not appropriate for my intensions.

Does anyone have any suggestions for a clean solution?



 


[flexcoders] Two ChartElement extension classes that catch MouseDowns (Charting)

2007-01-15 Thread g_odds
I have created two classes that extend ChartElement, one for zooming
and one for panning.  Both work as wanted if applied separately to a
chart using the annotationElements.  However, if I apply both only one
of the two will ever catch a MouseDown rather than both.  I worked out
how to implement the classes in the first place by looking at the
InteractiveBubble example on the Quietly Scheming website
(http://www.quietlyscheming.com/blog/charts/interactive-bubble-chart/).

The jist is that I have overridden the updateDisplayList(..) function
with the following to ensure the Pan or Zoom catches the mouse event:

override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth,unscaledHeight);
graphics.clear();
graphics.moveTo(0,0);
graphics.beginFill(0,0);
graphics.drawRect(0,0,unscaledWidth,unscaledHeight);
}

Clearly the problem I am having when I have two classes using this
same technique being used at the same time is because one of the
"rectangles" is on top of the other.

I realise that combining the pan and zoom into a single class, as is
done in the Quietly Scheming example, would solve the problem but it
is not appropriate for my intensions.

Does anyone have any suggestions for a clean solution?