Solved! Go to Solution.
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"       xmlns:s="library://ns.adobe.com/flex/spark"       xmlns:esri="http://www.esri.com/2008/ags">  <s:layout>   <s:VerticalLayout horizontalAlign="center"/>  </s:layout>  <fx:Script>   <![CDATA[    import com.esri.ags.Graphic;    import com.esri.ags.Map;    import com.esri.ags.SpatialReference;    import com.esri.ags.events.GeometryServiceEvent;    import com.esri.ags.geometry.MapPoint;    import com.esri.ags.symbols.SimpleMarkerSymbol;    import com.esri.ags.tasks.GeometryService;    import com.esri.ags.tasks.supportClasses.ProjectParameters;         //create the mappoint using the lat and long    private function createPoint():void     {      var testPoint:MapPoint = new MapPoint(76.0161244300, 30.7764803800);     //spatial reference of the mappoint     testPoint.spatialReference = new SpatialReference(4326);      var projParams:ProjectParameters = new ProjectParameters();     projParams.geometries = [testPoint];     //reproject to map spatial reference     projParams.outSpatialReference = myMap.spatialReference;     geometryService.project(projParams);         }         //reproject event     private function projectCompleteHandler(event:GeometryServiceEvent):void    {      try     {      // Note: As of version 2.0, GeometryService returns geometries (instead of graphics)            var pt:MapPoint = (event.result as Array)[0]as MapPoint;      var ptGraphic:Graphic = new Graphic(null, new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_DIAMOND, 22, 0x009933));      ptGraphic.geometry = pt;       myGraphicsLayer.clear()      myGraphicsLayer.add(ptGraphic);     }     catch (error:Error)     {      //Alert.show(error.toString());     }    }    ]]>  </fx:Script>  <fx:Declarations>   <esri:GeometryService id="geometryService" showBusyCursor="false" projectComplete="projectCompleteHandler(event)"            url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/>  </fx:Declarations>  <s:controlBarLayout>   <s:VerticalLayout gap="10" paddingBottom="7" paddingLeft="10" paddingRight="10" paddingTop="7"/>  </s:controlBarLayout>  <s:controlBarContent>   <s:Button id="btn" click="createPoint()" label="Add some more markers using ActionScript"/>  </s:controlBarContent>  <esri:Map id="myMap" level="2" wrapAround180="true">   <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>   <esri:GraphicsLayer id="myGraphicsLayer"/>  </esri:Map> </s:Application><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"       xmlns:s="library://ns.adobe.com/flex/spark"       xmlns:esri="http://www.esri.com/2008/ags">  <s:layout>   <s:VerticalLayout horizontalAlign="center"/>  </s:layout>  <fx:Script>   <![CDATA[    import com.esri.ags.Graphic;    import com.esri.ags.Map;    import com.esri.ags.SpatialReference;    import com.esri.ags.events.GeometryServiceEvent;    import com.esri.ags.geometry.MapPoint;    import com.esri.ags.symbols.SimpleMarkerSymbol;    import com.esri.ags.tasks.GeometryService;    import com.esri.ags.tasks.supportClasses.ProjectParameters;         //create the mappoint using the lat and long    private function createPoint():void     {      var testPoint:MapPoint = new MapPoint(76.0161244300, 30.7764803800);     //spatial reference of the mappoint     testPoint.spatialReference = new SpatialReference(4326);      var projParams:ProjectParameters = new ProjectParameters();     projParams.geometries = [testPoint];     //reproject to map spatial reference     projParams.outSpatialReference = myMap.spatialReference;     geometryService.project(projParams);         }         //reproject event     private function projectCompleteHandler(event:GeometryServiceEvent):void    {      try     {      // Note: As of version 2.0, GeometryService returns geometries (instead of graphics)            var pt:MapPoint = (event.result as Array)[0]as MapPoint;      var ptGraphic:Graphic = new Graphic(null, new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_DIAMOND, 22, 0x009933));      ptGraphic.geometry = pt;       myGraphicsLayer.clear()      myGraphicsLayer.add(ptGraphic);     }     catch (error:Error)     {      //Alert.show(error.toString());     }    }    ]]>  </fx:Script>  <fx:Declarations>   <esri:GeometryService id="geometryService" showBusyCursor="false" projectComplete="projectCompleteHandler(event)"            url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/>  </fx:Declarations>  <s:controlBarLayout>   <s:VerticalLayout gap="10" paddingBottom="7" paddingLeft="10" paddingRight="10" paddingTop="7"/>  </s:controlBarLayout>  <s:controlBarContent>   <s:Button id="btn" click="createPoint()" label="Add some more markers using ActionScript"/>  </s:controlBarContent>  <esri:Map id="myMap" level="2" wrapAround180="true">   <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>   <esri:GraphicsLayer id="myGraphicsLayer"/>  </esri:Map> </s:Application>myPolyline = new Polyline([[new mapPoint(x, y), new mapPoint(x, y)]], new SpatialReference(4326)); var myGraphicLine:Graphic = new Graphic(myPolyline); myGraphicLine.symbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, 0xFF0000, 1.0, 4); myGraphicsLayer.add(myGraphicLine);
var myPolyline:Polyline = new Polyline( [[ new MapPoint(-1726185, 9543036), new MapPoint(34923, 6920940), new MapPoint(1874303, 6255632), new MapPoint(1835168, 6255632), new MapPoint(1913439, 6138225) ]], new SpatialReference(102100)); var myGraphicLine:Graphic = new Graphic(myPolyline); myGraphicLine.symbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASH, 0xDD2222, 1.0, 4); myGraphicsLayer.add(myGraphicLine);