Perplexing Events

645
3
11-04-2010 12:15 PM
CharlieRichman
New Contributor
No, not the election.

I'm editing  a locally-instantiated featurelayer (populated using a featurecolleciton).

I trap the editor graphicsMoveStop event and also set listeners for the Flash MOUSE_UP mouse event on each of the features that are being moved.  (I do this because I really don't want them to be moved at all -- I push them back to where they started but run a query on the location where the mouse up event occurred and transfer attributes from the results to the layer I'm editing.

The challenge is that the MOUSE_UP events don't always fire when features are dragged.  They virtually always do with a single feature selected, but as we get towards having a dozen or two features selected they generally don't.  The editor event does fire in each case.  Is this a timing issue where if the mouse event doesn't fire before the editor event fires it will never fire?   Is there some way I can reliably capture the location where the mouse was released when dragging my features around?  I use listeners on the individual graphics instead of on the entire layer because I need to know whether the mouse event is triggered by dragging features to a new location or by clicking elsewhere to select something else.  (It isn't enough to know where the event occurs -- I need to know if features were dragged there or if something else was clicked there.)
Tags (2)
0 Kudos
3 Replies
CharlieRichman
New Contributor
Then again, when something seems too complicated it usually is 😉

I don't need to trap the mouse_up event as long as I can get the mouse coordinates when the edittool graphics move end event fires.  Which units are the map mousex and mousey properties in?  To transform them into map units do I use toMap() rather than the toMapFromStage that I would use in a mouse event?

Charlie Richman
DC Office of Planning
0 Kudos
DasaPaddock
Esri Regular Contributor
Is this the mouseX you're referring to?
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#...

I think this value will be in the DisplayObject's coordinate space. Try using this and then call Map.toMapFromStage();
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#...
0 Kudos
CharlieRichman
New Contributor
Yes, that did it nicely.  Far better to include something like this in the event fired by the edittool than to deal with competing mouse_up events:

var globalPoint:Point = myMap.localToGlobal(new Point(myMap.mouseX,myMap.mouseY));
var mp:MapPoint = myMap.toMapFromStage(globalPoint.x,globalPoint.y);

Thanks, Dasa.

Charlie Richman
DC Office of Planning
0 Kudos