ArcGIS for Flex-Flex4.0 using dropdownlist controls to switch GIS map Map

Source: Internet
Author: User

The graduation project uses flex as a map module and ArcGIS API for flex. Today, we will first make a map display and switch, first look at the running effect:

It mainly refers to the use of the dropdownlist control and how to use the ArcGIS control in flex to display maps. Paste the code below:

<? 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: MX = "Library: // ns.adobe.com/flex/mx" xmlns: ESRI = "http://www.esri.com/2008/ags" minwidth = "1000" minheight = "600"> <FX: SCRIPT> <! [CDATA [import MX. collections. arraylist; import MX. collections. xmllistcollection; import MX. controls. alert; import MX. events. indexchangedevent; import spark. events. indexchangeevent; private var showmapname: string; Private function mapselectorchangehandler (Event: indexchangeevent): void {showmapname = "http: // service: 8399/ArcGIS/rest/services/" + mapselector. selecteditem. value + "/mapserver/" // alert. show (showmapnam E); mapservicelayer. url = showmapname;}]> </FX: SCRIPT> <FX: declarations> <! -- Place a non-visual element (such as a service or value object) Here --> <s: xmllistcollection id = "mapnames"> <FX: xmllist xmlns = ""> <map> <Name> 856 farms </Name> <value> 856 </value> </map> <Name> ShuangFeng farm </ name> <value> ShuangFeng </value> </map> </FX: xmllist> </S: xmllistcollection> </FX: declarations> <ESRI: map id = "mapview" x = "144" Y = "41" width = "800" Height = "550"> <ESRI: arcgisdynamicmapservicelayer id = "mapservicelayer"/> </ESRI: Map> <s: dropdownlist id = "mapselector" Left = "5" Top = "5" Height = "20" fontsize = "13" fontweight = "normal" dataprovider = "{mapnames}" labelfield = "name" change = "mapselectorchangehandler (Event) "prompt =" map switching "> </S: dropdownlist> </S: Application>

Welcome to the discussion ~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.