I'd like to send a parameter with the Route Task and be able to get that same parameter in the RouteResult object. The goal is to be able to recognize the routes I receive from the server when I perform many solve operations on the same RouteTask.
|
There is no need to send something along to the server (and expecting it back). The AsyncResponder supports a third argument "token" which can be used for this. There is no need to create special classes or wrap it when the Adobe/Apache Flex SDK support it already :) token:Object (default = null) — Additional information to associate with this request. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/rpc/AsyncResponder.html#AsyncResponder() Some of the ArcGIS API for Flex samples take advantage of this, for example in the "Routing Directions" example which use it to keep track of the "from" and "to" geocodes: http://resources.arcgis.com/en/help/flex-api/samples/index.html#/Route_Directions/01nq0000000p000000/ |
|||
|
|
|
One solution would be to create your own custom geoprocess that wraps the RouteTask. You pass all the parameters for the RouteTask and your extra parameters and then return the result of the RouteTask along with your own parameters. I used this method to take geocoding parameters and my own custom parameters, then called the geoprocess function and returned geocoding results along with my own tracking parameters that I had passed in. |
|||
|
|
I think I'm going to create a new class that will contain its own RouteTask, the callback function for the RouteTask and my own parameters. Then each time I need to use a routeTask, I will use my new object created. What do you think? |
|||
|
|