Select to view content in your preferred language

EditEvent graphic null

1065
3
08-05-2010 10:37 AM
BernadetteSorenson
Emerging Contributor
I used the DrawTool object to draw a Polygon on my map, then activated an EditTool object to move the polygon. I added a graphicMoveStop event with handler to my EditTool. Here's the problem: when I move the polygon using the EditTool, I added an Alert to the graphicMoveStop handler to verify that the graphic is there (by printing out 'event.graphic'). The result - event.graphic is null. I need the extent of this graphic, but the graphic is not there. Is this a bug?
Tags (2)
0 Kudos
3 Replies
SarthakDatt
Frequent Contributor
Bernadette,

The EditTool supports moving multiple graphics at a time while it only allows you to edit the vertices of
one graphic. Hence the EditEvent has two properties - graphic and graphics http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/events/EditEvent.html

When you are moving graphic(s), you need to look at EditEvent.graphics(in your case it would be in the graphicMoveStop handler, event.graphics[0]), and when you are editing the vertices, you need to look at EditEvent.graphic

Hope it makes things clear.
0 Kudos
BernadetteSorenson
Emerging Contributor
Sarthak,

I used the graphics property in my graphicMoveStop handler and it worked! 
Thank you for your advice.

Bernadette
0 Kudos
BernadetteSorenson
Emerging Contributor
I've run into a problem with the vertexMoveStop handler. I am using the EditEvent.graphic to get the new extent of my polygon after moving vertices. The extent xmin, xmax, etc don't change in this event handler.

Here is my code:
var myNewGeometry:Geometry = event.graphic.geometry as Polygon;
var myMapPoint:MapPoint =
  new MapPoint(myNewGeometry.extent.xmin, myNewGeometry.extent.ymax);

When I print an Alert to compare the original Polygon extent to the edited Polygon extent (edited by moving vertices), I get the original values, as if the fired event has not updated the extent.
Did I miss something?
0 Kudos