Select to view content in your preferred language

Flex Sample Viewer TOC order

1096
5
09-27-2010 10:48 AM
DanielSmith
Frequent Contributor
Hello,

1) Thanks to all who contribute on these forums. This resource is beyond valuable.


2) i need to reorder my layers in the TOC. Specifically i have tiled and dynamic services in my application (running AGS 9.3.1 and associated Flex lib version) and i need to mix and match their groupings based on year. Essentially we have 1 dynamic layer containing all of our vector data (3 years  broken into group layers and ordered appropriately) and 6 tiled raster layers (2 for each year). i am looking for a way to put the year specific tiled services below the year specific group of vector data.

current TOC:
2009
  |- point 2009
  |- Line 2009
  |- Poly 2009
2008
  |- point 2008
  |- Line 2008
  |- Poly 2008
2009 Raster1
2009 Raster2
2008 Raster1
2008 Raster2

intended TOC:
2009
  |- point 2009
  |- Line 2009
  |- Poly 2009
  |- 2009 Raster 1
  |- 2009 Raster 2
2008
   |- point 2008
   |- Line 2008
   |- Poly 2008
  |-2008 Raster 1
  |-2008 Raster 2

Help is greatly appreciated and returned with MVP bumps (assuming that functionality has been enabled on these new forums)...

Have a great day,
Daniel
Tags (2)
0 Kudos
5 Replies
DanielSmith
Frequent Contributor
Well i forgot/realized that i can manipulate the config.xml file to re order the layers. This is kinda of a workaround because I will have to generate year specific map services (not that big a deal but we are a small firm with limited resources). 

This brings up the broader question though, How can/do you control the order of layers in the LiveMaps widget using Action script?

Thanks again,
Daniel
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Daniel,

    You can do the same thing in ActionScript using the Map.reorderLayer method

Example
ActionScript code to move a layer to the bottom of all layers:

     myMap.reorderLayer("myGraphicsLayer", 0);

ActionScript code to move a layer to the top of all other layers:

     myMap.reorderLayer("myTiledLayer", myMap.layers.length);


http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/Map.html
0 Kudos
DanielSmith
Frequent Contributor
Thank you very much Robert!

From my reading/understanding the map.reorderLayer() method reorders how map services are layered in the map and hence the TOC. But what do we do if we want to put a tiled service in between layers within a dynamic map service? Thanks again for your time.

Daniel
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Daniel,

   That is not feasible, from what I know of the TOC as it is now.
0 Kudos
DanielSmith
Frequent Contributor
huh...

Thanks for your help though Robert. Its always good to know what can and can't be done (easily).
0 Kudos