Robert / other Flex gurus,I believe I am on the right track, but am stuck again (if it isn't obvious, I'm new to Flex...) I have migrated the uniqueValueRenderer to ActionScript, but have not been able to successfully call the renderer and get it to work. Here's my AS in the component file:
package widgets.MyWidget.components
{
import com.esri.ags.renderers.UniqueValueRenderer;
import com.esri.ags.renderers.supportClasses.UniqueValueInfo;
import com.esri.ags.symbols.SimpleMarkerSymbol;
public class ResultRenderer extends UniqueValueRenderer
{
public static var resultPointSym:UniqueValueRenderer = new UniqueValueRenderer();
public function ResultRenderer()
{
super();
var tier1:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 12, 0xFF0000);
var tier2:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 12, 0xFF4400);
resultPointSym.field = "Tier";
var resultPointSymInfos:Array=[];
resultPointSymInfos.push(new UniqueValueInfo(tier1, "1"));
resultPointSymInfos.push(new UniqueValueInfo(tier2, "2"));
resultPointSym.infos = resultPointSymInfos;
}
}
}
And the pertinent script in the main file:
import widgets.MyWidget.components.ResultRenderer;
protected function onGetResult(event : GeoprocessorEvent) : void
{
var myGraphicsLayer:GraphicsLayer = new GraphicsLayer();
myGraphicsLayer.renderer = ResultRenderer.resultPointSym;
var pv:ParameterValue = event.parameterValue;
var fs:FeatureSet = pv.value as FeatureSet;
for each(var graphic:Graphic in fs.features)
{
myGraphicsLayer.add(graphic);
}
map.addLayer(myGraphicsLayer);
CursorManager.removeBusyCursor();
}
Flex Builder gives no errors and successfully compiles the code, but the results aren't rendered. (I can see via Firebug that the results are returned... the JSON looks just as it's supposed to & the field name in the AS is correct).Again, many thanks for any help or guidance. As a more general question, are there any widgets that do a particularly good job of splitting functionality into components like this & which might be useful examples? Thanks!-Erik