copy:http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=100352
先在河流的属性表生成字段e.g. Type设定不同河流的等级, 并以一个ArrayCollection将其储存:
<mx:ArrayCollection>
<mx:String>Type</mx:String>
<mx:Number>1</mx:Number>
<mx:Number>2</mx:Number>
<mx:Number>3</mx:Number>
<mx:Number>4</mx:Number>
</mx:ArrayCollection>
之后为个别类别设定不同的颜色并为其编号:
</mx:ControlBar>
<esri:SimpleFillSymbol id="a1" alpha="0.8" color="0x00FF00" />
<esri:SimpleFillSymbol id="a2" alpha="0.8" color="0x00FFFF" />
<esri:SimpleFillSymbol id="a3" alpha="0.8" color="0xFF0000" />
<esri:SimpleFillSymbol id="a4" alpha="0.8" color="0xFF6600" />
之后用Renderer的方式为其上色:
<esri:UniqueValueRenderer id="uniqueValueRenderer" attribute="Type">
<esri:UniqueValueInfo value="1" symbol="{a1}"/>
<esri:UniqueValueInfo value="2" symbol="{a2}"/>
<esri:UniqueValueInfo value="3" symbol="{a3}"/>
<esri:UniqueValueInfo value="4" symbol="{a4}"/>
</esri:UniqueValueRenderer>
最后在GraphicsLayer中设定其Renderer为UniqueVaueRenderer就可以:
<esri:GraphicsLayer id="myGraphicsLayer", renderer="{uniqueValueRenderer}" />