ADD the Web map to the application
Excerpt from Source: https://developers.arcgis.com/flex/guide/tutorial-add-a-web-map-to-the-application.htm
thisthe Webmaputil class is a Web map project information based on a given ID used to create a map, this class needs to work on an online ArcGIS Web map, or you can use the ArcGIS portal site, and by setting the arcgissharingurl Property , this tutorial uses online ArcGIS maps to learn
In Flash Builder, create a new project and join the Flex API library
In the editor view, add the following code. Also, be sure to reference the ESRI namespace
<?xml version= "1.0" encoding= "Utf-8"? ><s:application xmlns:fx= "http://ns.adobe.com/mxml/2009" xmlns:s= " Library://ns.adobe.com/flex/spark "xmlns:esri=" Http://www.esri.com/2008/ags "initialize=" Application_ InitializeHandler (Event) "><fx:Script> <! [cdata[import com.esri.ags.events.WebMapEvent; Import Mx.controls.Alert; Import mx.events.FlexEvent; protected function Application_initializehandler (event:flexevent): void {Webmaputil.createmapbyid ("4778fee6371d4e8 3a22786029f30c7e1 "); } protected function Webmaputil_createmapbyidcompletehandler (event:webmapevent): void {addelementat (event.map, 0 ); }]]></fx:script><fx:declarations> <esri:webmaputil id= "Webmaputil" createMapByIdComplete= "WebMa Putil_createmapbyidcompletehandler (event) "fault=" Alert.show (event.fault.faultString); " /> </fx:declarations><s:label top= "fontsize=" horizontalcenter= "0" text= "ArcGIS.com Web Map"/&G t;</S:application>
When the program
initializeHandler
The function is triggered and uses the provided Web map ID 4778fee6371d4e83a22786029f30c7e1
Once the map is finished building, thecreateMapByIdCompleteHandler
The function is triggered and the event is calledSpark container ' s containeraddElement
functions are passed in the map
Run effect
ArcGIS API for Flex (add a Web map to your application)