We are currently trying to label feature layers also.The approach we are taking is to add textSymbol graphics to a graphics layer.Crude code:
var featureLayer:FeatureLayer = event.target as FeatureLayer;
var features:ArrayCollection = featureLayer.graphicProvider as ArrayCollection;
var labelGraphicsLayer:GraphicsLayer = new GraphicsLayer();
map.addLayer(labelGraphicsLayer);
for(var i:int=0;i<features.length;i++)
{
var g:Graphic=features.getItemAt(i) as Graphic;
var x:Number=g.geometry.extent.center.x;
var y:Number=g.geometry.extent.center.y;
var geomPoint:MapPoint = new MapPoint(x,y,map.spatialReference);
var textSymbol:TextSymbol = new TextSymbol();
textSymbol.color = 0x00ff00;
textSymbol.text = g.attributes["TITLE"];
var textGraphic:Graphic = new Graphic();
textGraphic.geometry = geomPoint;
textGraphic.symbol = textSymbol;
labelGraphicsLayer.add(textGraphic);
}
This seems to work but we've still got a bit of work to do around positioning ( no overlapping labels etc)Having said that, I think I might explore PopUpRenderer as Schlot suggests. That may handle it all better.If I remember, I'll update this post with our result.AndrewWellington, New Zealand