Hey Flex Gurus,
I'm trying to calculate the total length of my polylines after a query and adding graphics: I found this code and I'm trying to get it to work but not having any luck:
private function executeCompleteHandler(event:QueryEvent):void
{
for each (var myGraphic:Graphic in event.featureSet.features)
{
myGraphic.addEventListener(MouseEvent.CLICK, unselectGraphic);
myGraphic.addEventListener(MouseEvent.ROLL_OVER, toggleMapClick);
myGraphic.addEventListener(MouseEvent.ROLL_OUT, toggleMapClick);
myGraphicsLayer.add(myGraphic);
var lengths:Array = GeometryUtil.geodesicLengths([ new Polyline(myGraphic.geometry.extent.toPolygon().rings)], Units.MILES);
var i:int = 0;
length+=lengths;
i++;
}
Any thoughts on how I could calculate the total length of the lines with the geodesicLengths method. I'm not sure what the Polyline(mygGraphic...) method is even calculating here. I found it on a post here in the forums but it's giving me way too big of a number. Any advice would be much appreciated.
Thanks Flex Jedi Masters,
Thomas