Hello,I am new at ArcGIS flex API. I want to do a basic route task. I have created a route network using network analyst. In ArcMap it is working fine. I have merged all road layer into one layer. It is a very simple polyline data. It has no time, barrier, u-turns or historical traffics data. I have published it into ArcGIS Server with network access. Now when I am changing the rest endpoint in Basic Routing Code of Flex it is not showing the Routing Layer in Browser. When I am clicking for 2 stops it attaching the triangle marker and it is calculating Route (Its showing the busy cursor tool for a long time if I click 2 stop to a far distance or its taking a little time if i click near to each other). I am giving the Coding...I am attaching the Route and street files. Please help me to learn this Topic. <?xml version="1.0" encoding="utf-8"?>
<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"
pageTitle="Routing with the ArcGIS API for Flex">
<s:layout>
<s:VerticalLayout paddingTop="10"/>
</s:layout>
<fx:Script>
<![CDATA[
import com.esri.ags.FeatureSet;
import com.esri.ags.Graphic;
import com.esri.ags.events.MapMouseEvent;
import com.esri.ags.events.RouteEvent;
import com.esri.ags.tasks.supportClasses.RouteResult;
import com.esri.ags.utils.WebMercatorUtil;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
private var lastRoute:Graphic;
private function mapClickHandler(event:MapMouseEvent):void
{
var stop:Graphic = new Graphic(event.mapPoint, stopSymbol);
graphicsLayer.add(stop);
stops.push(stop);
if (stops.length > 1)
{
routeTask.solve(routeParams);
}
}
private function solveCompleteHandler(event:RouteEvent):void
{
var routeResult:RouteResult = event.routeSolveResult.routeResults[0];
routeResult.route.symbol = routeSymbol;
graphicsLayer.remove(lastRoute);
// TODO: if your server is AGS10, you can ask for it to be projected
// (instead of having to project it clientside)
routeResult.route.geometry = WebMercatorUtil.geographicToWebMercator(routeResult.route.geometry);
lastRoute = routeResult.route;
lastRoute.toolTip = routeResult.routeName;
if (routeResult.stops && routeResult.stops.length > 0)
{
lastRoute.toolTip += " with " + routeResult.stops.length + "stops";
}
if (routeResult.route.attributes.Total_Time)
{
lastRoute.toolTip += " in " + Math.round(Number(routeResult.route.attributes.Total_Time)) + " minutes.";
}
graphicsLayer.add(lastRoute);
}
private function faultHandler(event:FaultEvent):void
{
Alert.show(event.fault.faultString + "\n\n" + event.fault.faultDetail, "Routing Error " + event.fault.faultCode);
// remove last stop (or both stops if only two)
if (stops.features.length <= 2)
{
graphicsLayer.clear();
}
else
{
graphicsLayer.remove(stops.features.pop());
}
}
]]>
</fx:Script>
<fx:Declarations>
<esri:RouteTask id="routeTask"
concurrency="last"
fault="faultHandler(event)"
requestTimeout="30"
showBusyCursor="true"
solveComplete="solveCompleteHandler(event)"
url="http://pioneer/ArcGIS/rest/services/DhakaRouteNew/NAServer/Route"/>
<esri:RouteParameters id="routeParams">
<esri:stops>
<esri:FeatureSet>
<esri:features>
<fx:Array id="stops"/>
</esri:features>
</esri:FeatureSet>
</esri:stops>
</esri:RouteParameters>
<esri:SimpleMarkerSymbol id="stopSymbol"
size="15"
style="triangle">
<esri:SimpleLineSymbol width="4"/>
</esri:SimpleMarkerSymbol>
<esri:SimpleLineSymbol id="routeSymbol"
width="10"
alpha="0.5"
color="0x0000FF"/>
</fx:Declarations>
<s:Label fontSize="12" text="Click on the map to add stops for your routing..."/>
<esri:Map mapClick="mapClickHandler(event)" openHandCursorVisible="false">
<esri:ArcGISDynamicMapServiceLayer url="http://pioneer/ArcGIS/rest/services/DhakaRouteNew/MapServer"/>
<esri:GraphicsLayer id="graphicsLayer"/>
</esri:Map>
</s:Application>