Yup. To do mouse tracking, you generally need a mouse down, mouse move,
and mouse up handler. Almost all of my code that does mouse tracking
looks like this:
<someComponent mouseDown="startTracking(event);" />
private function startTracking(e:MouseEvent):void
{
// listen to the systemManager so we get mouse move/up events even
when the mouse moves outside the component.
// listen on capture so we can cancel move/rollover events going to
other components.
systemManager.addEventListener(MouseEvent.MOUSE_MOVE,track,true);
systemManager.addEventListener(MouseEvent.MOUSE_UP,endTracking,true);
track(e);
}
private function track(e:MouseEvent):void
{
// update your data/UI here.
}
private function endTracking(e:MouseEvent):void
{
track(e);
// remove the event listeners until we need to track again.
systemManager.removeEventListener(MouseEvent.MOUSE_MOVE,track,true);
systemManager.removeEventListener(MouseEvent.MOUSE_UP,endTracking,true);
}
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tom Fitzpatrick
Sent: Tuesday, November 28, 2006 9:37 AM
To: [email protected]
Subject: Re: [flexcoders] Re: Hands-on charts
I'm trying out your suggested approach and ran into a conceptual
problem. I can get the mouse coordinates and convert them to data on the
mouseDown event - but then how do I track the mouse movement, since that
uses a different event (mouseMove), and the function I'm working with is
already tied to the mouseDown? The movement tracking seems necessary to
get the "new" coordinates.
- Tom
Ely Greenfield wrote:
>
>
>
> It depends on just how much data you're trying to show in the chart,
> but chances are good that it will be very responsive.
>
> Ely.
>
>
> ----------------------------------------------------------
> *From:* [email protected]
<mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
]
> *On Behalf Of *tom24569
> *Sent:* Monday, November 27, 2006 12:08 PM
> *To:* [email protected] <mailto:flexcoders%40yahoogroups.com>
> *Subject:* [flexcoders] Re: Hands-on charts
>
> Would this happen fast enough that the chart would seem to be
> responding to the mouse movement?
>
> - Tom
>
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>, "Ely Greenfield" <[EMAIL PROTECTED]>
> wrote:
> >
> >
> >
> > Hi Tom. There's no interative modelling built in, but this should be
> > pretty easy to do:
> >
> > 1) listen for itemMouseDown events.
> > 2) track the mouse position
> > 3) convert the mouse position into data coordinates using the
> > chart.localToData() function.
> > 4) write the new data coordinates into your dataProvider
> >
> >
> > Ely.
> >
> >
> > ________________________________
> >
> > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>] On
> > Behalf Of Tom Fitzpatrick
> > Sent: Monday, November 27, 2006 6:34 AM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> > Subject: [flexcoders] Hands-on charts
> >
> >
> >
> > Flex charts work beautifully responding to dynamic changes in data.
> >
> > Using the current components, is there any way to use Flex charts to
> > change data?
> >
> > As a conceptual model, I'm thinking of the way parametric equalizers
> > work in some audio programs, where it's possible to drag nodes on a
line
> >
> > graph vertically or horizontally to change the parametric data.
> >
> > - Tom
> >
>
>