yahoo groups disabled my regular email (though it's still sending me
email) & the copy/paste from tbird messed up the formatting something
fierce, so here we go again:
we're building some functions that will interact w/an image to measure
some stuff (areas, linear distances, angles, etc.) so we need to handle
mouse events. if we point at an event listener from the mxml component
things work
as expected (ie like js which is where the original functions are
being ported from).
<mx:Canvas id="mapCanvas" width="100%" height="300"
horizontalScrollPolicy="off" verticalScrollPolicy="off"
mouseDown="angleToolMouseDown(event)"
mouseMove="angleToolMouseMove(event)"
mouseUp="angleToolMouseUp(event)"/>
the issue is that we're swapping event listeners based on the "tool"
the user selects & after adding a new event listener, mouse clicks seem to be
seen by our event handlers as 2 events (basically another copy of
itself) which is
messing up our measuring tools pretty good. our event handlers are
pretty simple:
private function angleToolMouseDown(event:MouseEvent):void {
showCoords(event); //whatever show coords to user
xPoints.push(event.localX); // save points to calc angle
yPoints.push(event.localY);
}
we found a "workaround" by setting the useCapture option to true:
mapCanvas.addEventListener(MouseEvent.MOUSE_DOWN,angleToolMouseDown,
true);
but i really can't see why this needs to be done especially as it
works when added as part of the mxml object definition. can anyone elaborate?
i'd also like to know if the way we're approaching this (adding/removing
listeners) is the right way? would a static handler which called other
functions based on the current tool be better?
thanks.
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/