private function rovGrid_Click():void { var obj:Object = rovGrid.selectedItem; if (obj != null) { MainMap.infoWindow.hide(); var graphic:Graphic = findGraphicByAttribute(obj, layerROVGraphics); var path:Polyline = graphic.geometry as Polyline; var halfway:int = path.paths[0].length/2; var mapPoint:MapPoint = path.getPoint(0,halfway); if (graphic == null) { Alert.show ("This transect cannot be found"); return; } if (chkROVZoom.selected) { MainMap.extent = graphic.geometry.extent; if (!MainMap.extent.containsExtent(graphic.geometry.extent)) {MainMap.level--;} } //I didn't include the function to fill the content of the infoWindow MainMap.infoWindow.content = Functions.createVideoWindow(graphic); MainMap.infoWindow.label = "Transect: " + graphic.attributes.Name; MainMap.infoWindow.show(mapPoint); } } private function findGraphicByAttribute(attributes:Object, graphicLayer:GraphicsLayer):Graphic { for each (var graphic:Graphic in graphicLayer.graphicProvider) { if (graphic.attributes["OBJECTID"] == attributes["OBJECTID"]) { return graphic; } } return null; }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.