purpose:
1. arcGIS API for flex allows you to browse your ArcGIS. the map published in server.9.3, is a basic example.
preparation:
1. in ArcGIS. server.9.3 publishes a map service named USA and starts the service.
2. Install flex builder3.
3. download the ArcGIS API for flex Library Development Kit arcgis_flex_api_1.0-beta and decompress it to the folder, address: http://resources.esri.com/arcgisserver/apis/flex/index.cfm
after completion:
Start:
1. StartFlex builder3Click file-> New-> flex project in the menu, enter the project name Project name: flexmapapp, and click Next to select the Output Folder (you do not need to modify the default) to continue next and the following interface is displayed:
2. In the interface above, click library path and then click Add SWC to find the agslib-1.0-beta-2008-07-31.swc file extracted above to the directory and click OK.ArcGIS API for flex Library Development KitIntroduced into the project, you can use the flex component provided by ESRI in the project.
3Click Finish to complete the project creation. After the project is created, a flexmapapp. mxml file will be created by default. This is the flex page file and check the Code:
1 <? XML version = "1.0" encoding = "UTF-8" ?>
2 < MX: Application Xmlns: MX = "Http://www.adobe.com/2006/mxml" Layout = "Absolute" >
3
4 </ MX: Application >
5
4. it is an empty page. Next, add the map control to this page. The map control in flex supports several types of layers, including arcgisdynamicmapservicelayer, arcgisimageservicelayer, worker, arcimsmapservicelayer, and graphicslayer, the differences between layer types can be known by name, for example, arcgisdynamicmapservicelayer supports ArcGIS Server Publish a common map service, arcgistiledmapservicelayer supports ArcGIS. slice cache MAP released by server...
5. use arcgisdynamicmapservicelayer , because the USA's map service is a common dynamically generated map, to add a map control, enter Code .
you can enter the code in the label as follows:
1 < MX: Application Xmlns: MX = "Http://www.adobe.com/2006/mxml" Layout = "Absolute" Xmlns: ESRI = "Http://www.esri.com/2008/ags" >
2 < ESRI: Map >
3 < ESRI: arcgisdynamicmapservicelayer URL = "Http: // jh-53a435fbc0e8/ArcGIS/rest/services/USA/mapserver" />
4 </ ESRI: Map >
5 </ MX: Application >
<ESRI: Arcgisdynamicmapservicelayer> the attribute URL is published above.Map Service of USA.
In this way, you can directly view the map effect, which is very simple.
6. You can set the attributes of the map control. The common attributes are described as follows:
Clickrecenterenabled: True/false whether to enable the function of pressing shift to click map positioning center.
Crosshairvisible: True/false Whether to display a cross in the center of the map.
Doubleclickzoomenabled : True/false: whether to enable double-click map enlargement.
Keyboardnavigationenabled: True/false: whether to enable the zoom-in or zoom-out function for map navigation on the keyboard.
Mapnavigationenabled : True/false: whether to enable map navigation.
Panarrowsvisible: True/false: whether to display the function of moving the map arrow buttons on the four sides of the MAP and the four corners.
Panenabled : True/false: whether to enable the drag/drop map movement function.
Rubberbandzoomenabled: True/false?Enable the zoom in map function by SHIFT + drop box.
Scalebarvisible : True/false: whether to display the zoom-in or zoom-out button.
Scrollwheelzoomenabled: True/false: whether to enable zoom in or out of the scroll wheel.
Logovisible: True/false indicates whether the logo icon is displayed on the map.
7: All the code in this example is as follows:
1 <? XML version = "1.0" encoding = "UTF-8" ?>
2 < MX: Application Xmlns: MX = "Http://www.adobe.com/2006/mxml" Layout = "Absolute" Xmlns: ESRI = "Http://www.esri.com/2008/ags" Backgroundcolor = "White" >
3 < ESRI: Map Horizontalcenter = "-34" Verticalcenter = "1" Width = "400" Height = "250" Logovisible = "False" Borderstyle = "Solid" Crosshairvisible = "True" Panarrowsvisible = "True" >
4 < ESRI: arcgisdynamicmapservicelayer URL = "Http: // jh-53a435fbc0e8/ArcGIS/rest/services/USA/mapserver" />
5 </ ESRI: Map >
6 </ MX: Application >