Using Map |
||
|
This tutorial shows you how to create an application with a map zoomed in to a specific location, illustrating how the ArcGIS API for Flex is used in an MXML page.
The following is the sample MXML code in its entirety:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:esri="http://www.esri.com/2008/ags"
pageTitle="Tutorial - adding a map"
>
<esri:Map>
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
<esri:extent>
<esri:Extent xmin="-17.3" ymin="-34.6" xmax="51.1" ymax="38.2"/>
</esri:extent>
</esri:Map>
</mx:Application>
View a sample.
Your code should always contain the same two parts:
<esri:Map>
When you first use the esri namespace, Flex Builder automatically adds the namespace to the application tag. When you add <esri:Map>, Flex Builder automatically creates its matching end tag </esri:Map>.
<esri:ArcGISTiledMapServiceLayer
url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
The StreetMap service, a tiled MapService layer, is initialized using the ArcGISTiledMapServiceLayer constructor. The URL is the endpoint for this service. This endpoint is a reference to a service that you can find out using Services Directory.
<esri:extent>
<esri:Extent xmin="-17.3" ymin="-34.6" xmax="51.1" ymax="38.2"/>
</esri:extent>