Hi i used this method when i am working with ArcGIS Online
public static MapPoint MidPoint(this Polyline polyline)
{
var length = polyline.Length();
var m = length / 2.0;
return polyline.LinearPosition(m);
}
If you are familiar with flex please fallow this example you will get an idea to calculate mid point of polyline
http://gisengineering.blogspot.in/2011/03/determine-midpoint-for-polyline-for.html
It did something different..Instead of finding the mid point i went with a point on polyline which is approximately in centre
var graphic = featureSet.features;
graphic.setSymbol(symbol);
graphic.setInfoTemplate(infoTemplate);
var ext = graphic.geometry.getExtent();
map.setExtent(ext);
var length = graphic.geometry.paths[0].length;
var pointxy= graphic.geometry.paths[0][(length/2];
var point = new esri.geometry.Point(pointxy[0], pointxy[1], new esri.SpatialReference({ wkid: 102100 }));
var simpleMarkerSymbol = new esri.symbol.PictureMarkerSymbol({
"type": "esriPMS",
"url": "image/E1BA914F.png",
"contentType": "image/png",
"color": null,
"width": 32,
"height": 32,
"angle": 0,
"xoffset": 16,
"yoffset": 8
});
var balloon = new esri.Graphic(point, simpleMarkerSymbol);
map.graphics.add(balloon);