Select to view content in your preferred language

switch basemap on mobile application flex

581
2
Jump to solution
11-01-2013 05:46 AM
francescodi_vito
Deactivated User
Hello everyone, I have a problem with displaying the base map when I open my application using the switch basemap.
I have developed a mobile application and I used the example of a switch basemaps, but I used a caloutbutton INSIDE tHIS with the list of maps instead  the buttons visible on the map. When I launch the application does not load the map but as soon as I click on the calout button to open the list of maps is immediately loaded.
How can I do to display the map as soon as you launch the application without having to click on caloutbutton?
this is my code
<?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"    xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView" xmlns:esri="http://www.esri.com/2008/ags">  <fx:Script>   <![CDATA[    import spark.events.DropDownEvent;        protected function calloutbutton1_openHandler(event:DropDownEvent):void    {     // TODO Auto-generated method stub         }        protected function calloutbutton1_closeHandler(event:DropDownEvent):void    {     // TODO Auto-generated method stub         }       ]]>  </fx:Script>  <fx:Script>   <![CDATA[    import com.esri.ags.geometry.MapPoint;    import com.esri.ags.layers.TiledMapServiceLayer;        import mx.events.FlexEvent;        private function layerShowHandler(event:FlexEvent):void    {     // update the LODs/zoomslider to use/show the levels for the selected base map     var tiledLayer:TiledMapServiceLayer = event.target as TiledMapServiceLayer;     map.lods = tiledLayer.tileInfo.lods;    }   ]]>  </fx:Script>  <fx:Declarations>   <!-- Place non-visual elements (e.g., services, value objects) here -->  </fx:Declarations>  <fx:Declarations>   <esri:Extent id="initialExtent"       xmin="-13635000" ymin="4541000" xmax="-13625000" ymax="4547000">    <esri:SpatialReference wkid="102100"/>   </esri:Extent>  </fx:Declarations>        <esri:Map extent="{initialExtent}" id="map" zoomSliderVisible="false">   <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)"            url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"            visible="{bb.selectedIndex == 0}"/>   <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)"            url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"            visible="{bb.selectedIndex == 1}"/>   <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)"            url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"            visible="{bb.selectedIndex == 2}"/>   <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)"            url="http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer"            visible="{bb.selectedIndex == 3}"/>   <esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)"            url="http://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer"            visible="{bb.selectedIndex == 4}"/>  </esri:Map>  <s:actionContent>   <s:CalloutButton close="calloutbutton1_closeHandler(event)"        open="calloutbutton1_openHandler(event)" visible="true">    <s:icon>     <s:MultiDPIBitmapSource source160dpi="mobile160/assets/2_action_about.png"/>    </s:icon>    <s:List id="bb" requireSelection="true" width="240" color="black">     <s:dataProvider>     <s:ArrayList>      <fx:String>Streets</fx:String>      <fx:String>Topographic</fx:String>      <fx:String>Imagery</fx:String>      <fx:String>Oceans</fx:String>      <fx:String>National Geographic</fx:String>     </s:ArrayList>     </s:dataProvider>    </s:List>   </s:CalloutButton>  </s:actionContent> </s:View>

any help is well come
bye
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Francesco,

   Set the selectedIndex on the list component.

<s:List id="bb" requireSelection="true" width="240" color="black" selectedIndex="0">

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Francesco,

   Set the selectedIndex on the list component.

<s:List id="bb" requireSelection="true" width="240" color="black" selectedIndex="0">
0 Kudos
francescodi_vito
Deactivated User
thanks Robert
0 Kudos