I've built a Flex widget to enable a user to select an icon (in PNG format) and then place it on the map using the DrawTool. What I want the user to then be able to do is change the size and placement of the icon.I thought I could do this, but getting a little stumped as the examples I've found are all for graphics. So I'm trying to work of this example here:
private function map_mouseUpHandler(event:MouseEvent):void
{
event.currentTarget.removeEventListener(MouseEvent.MOUSE_MOVE, map_mouseMoveHandler);
event.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, map_mouseUpHandler);
if (event.target is Graphic)
{
graphic = Graphic(event.target);
if (lastEditGraphic !== graphic)
{
lastEditGraphic = graphic;
lastActiveEditTypes = "moveRotateScale"; // make sure move and edit vertices is the 1st mode
}
if (graphic.geometry is Polyline || graphic.geometry is Polygon)
{
if (lastActiveEditTypes == "moveEditVertices")
{
lastActiveEditTypes = "moveRotateScale";
myEditTool.activate(EditTool.MOVE | EditTool.SCALE | EditTool.ROTATE, [ graphic ]);
}
else
{
lastActiveEditTypes = "moveEditVertices";
myEditTool.activate(EditTool.MOVE | EditTool.EDIT_VERTICES, [ graphic ]);
}
}
else if (graphic.geometry is Extent)
{
myEditTool.activate(EditTool.MOVE | EditTool.SCALE, [ graphic ]);
}
else if (graphic.graphicsLayer == myGraphicsLayer)
{
myEditTool.activate(EditTool.MOVE | EditTool.EDIT_VERTICES, [ graphic ]);
}
}
else
{
myEditTool.deactivate();
lastActiveEditTypes = "moveRotateScale"; // make sure move and edit vertices is the 1st mode
}
}
However when it gets to the first if statement (the user clicks on the PNG icon on the map as they want to move it), it returns false as it is not a Graphic it returns "[object Sprite]", which I don't really understand. And this bit here:graphic = Graphic(event.target);won't work either as it's not returned, so not sure how to go about doing this?