Select to view content in your preferred language

actionscript ArcGISTiledMapServiceLayer + Graphics Layer => no map

1168
1
Jump to solution
06-14-2013 11:57 AM
MatthewMah
New Contributor
I have a very simple example of an application using a ArcGISTiledMapServiceLayer. I would like to use the actionscript version rather than the MXML version to dynamically change the available layers. The problem is once I introduce a GraphicsLayer, the map no longer shows up. Without the GraphicsLayer, the map displays normally. Also, if I use the MXML version (commented line) instead of the actionscript version, it also displays normally.

I have also tried adding the index argument to the addLayer function, but this has no effect.

Is there something simple I am missing, or is this a bug?

<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"          xmlns:s="library://ns.adobe.com/flex/spark"          xmlns:mx="library://ns.adobe.com/flex/mx"         xmlns:esri="http://www.esri.com/2008/ags"         creationComplete="init(event)"         >  <fx:Declarations>   <!-- Place non-visual elements (e.g., services, value objects) here -->  </fx:Declarations>    <fx:Script>   <![CDATA[    import com.esri.ags.layers.ArcGISTiledMapServiceLayer;    private function init(event : Event = null) : void{     var layer : ArcGISTiledMapServiceLayer = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");     test.addLayer(layer);    }   ]]>  </fx:Script>    <esri:Map id="test">                 <!--<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>-->   <esri:GraphicsLayer id="breaksMap"/>     </esri:Map> </s:WindowedApplication>
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
mm-und,

You will nedd to set the lods when you have a map that has a graphics layer added as the first layer and then you want to add a tiled layer. you can get the lods from the tiled layer, but the map does this automatically when the tiled layer is already added to to the map as it is in your mxml case.

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

View solution in original post

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus
mm-und,

You will nedd to set the lods when you have a map that has a graphics layer added as the first layer and then you want to add a tiled layer. you can get the lods from the tiled layer, but the map does this automatically when the tiled layer is already added to to the map as it is in your mxml case.

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

0 Kudos