Select to view content in your preferred language

How to add an esri renderer to a feature layer in ActionScript rather than in mxml?

3313
1
Jump to solution
10-10-2012 07:44 AM
XintaoLiu
Deactivated User
I created a feature layer in action script. Before adding the feature layer to map, how to add an renderer to it? Thank in advance!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Xinato,

   Here is some sample code:

var picSymbol:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/i_camera.png",30,30,0,0,0);             var rend:Renderer = new SimpleRenderer(picSymbol);             featureLayer.renderer = rend;


You can also look at the documentation about unique value renderer:

http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/renderers/UniqueValueRenderer.html

Here is an example of that:

var picSymbol2:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/bat.png",30,30,0,0,0);             var picSymbol3:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/horse.png",30,30,0,0,0);             var picSymbol4:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/mansion.png",30,30,0,0,0);             var uniqueValuerenderer:UniqueValueRenderer = new UniqueValueRenderer();             uniqueValuerenderer.field = "NAME";             var uniqueValueInfos:Array = [];             uniqueValueInfos.push(new UniqueValueInfo(picSymbol3, "Chuchhill Downs"));             uniqueValueInfos.push(new UniqueValueInfo(picSymbol2, "louisville slugger factory"));             uniqueValueInfos.push(new UniqueValueInfo(picSymbol4, "Whitehall Mansion"));             uniqueValuerenderer.infos = uniqueValueInfos;             featureLayer.renderer = uniqueValuerenderer;


Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:

View solution in original post

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus
Xinato,

   Here is some sample code:

var picSymbol:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/i_camera.png",30,30,0,0,0);             var rend:Renderer = new SimpleRenderer(picSymbol);             featureLayer.renderer = rend;


You can also look at the documentation about unique value renderer:

http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/renderers/UniqueValueRenderer.html

Here is an example of that:

var picSymbol2:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/bat.png",30,30,0,0,0);             var picSymbol3:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/horse.png",30,30,0,0,0);             var picSymbol4:PictureMarkerSymbol = new PictureMarkerSymbol("assets/images/mansion.png",30,30,0,0,0);             var uniqueValuerenderer:UniqueValueRenderer = new UniqueValueRenderer();             uniqueValuerenderer.field = "NAME";             var uniqueValueInfos:Array = [];             uniqueValueInfos.push(new UniqueValueInfo(picSymbol3, "Chuchhill Downs"));             uniqueValueInfos.push(new UniqueValueInfo(picSymbol2, "louisville slugger factory"));             uniqueValueInfos.push(new UniqueValueInfo(picSymbol4, "Whitehall Mansion"));             uniqueValuerenderer.infos = uniqueValueInfos;             featureLayer.renderer = uniqueValuerenderer;


Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:

0 Kudos