The Flash map of China uses objects as the data source to facilitate visualization projects based on the map of China.
Features:
- Swc for easy import to the Flex Project
- The data source is an Object, which is more convenient than XML.
- Data-driven map block color and Hover color
- You can configure whether to display the province name.
- Fast and convenient
Code License: Apache 2.0
Author: ComingX Jingle
Download: Git Repo
Usage:
- Create a Flex project and copy ChinaMap. swc to the libs directory of the project.
- Map = new Map ()
1 <? Xml version = "1.0" encoding = "UTF-8"?> 2 <! -- 3 * ComingX.com Business License 4*5 * Copyright 2013. all rights reserved. 6*7 * @ Author: Jingle 8 * @ Email: jingdongemail@gmail.com 9 * @ Created date: 2013-6-2710 --> 11 <s: Application xmlns: fx = "http://ns.adobe.com/mxml/2009" 12 xmlns: s = "library: // ns.adobe.com/flex/spark" 13 xmlns: mx = "library: // ns.adobe.com/flex/mx "minWidth =" 955 "minHeight =" 600 "14 creationComplete =" application1_1_creationcom PleteHandler (event) "15> 16 <fx: Declarations> 17 <! -- Place non-visual elements (such as services and value objects) Here --> 18 </fx: Declarations> 19 <fx: Script> 20 <! [CDATA [21 import com. comingx. jingle. chinamap. domains. initData; 22 23 import mx. events. flexEvent; 24 import mx. flash. UIMovieClip; 25 private var map: UIMovieClip; 26 27 protected function application1_1_creationcompletehandler (event: FlexEvent): void28 {29 map = new Map (); 30 test. addElement (map); 31 var initData: InitData = new InitData (); 32 initData. isShowProvinceName = false; 33 initData. provinceDataArray = [34 {"id": 11, "name": "beijing", "color": 0xff4400, "hoverColor": 0xff0000}, 35 {"id": 12, "name": "tianjin", "color": 0 xccffcc, "hoverColor": 0xff0000}, 36 {"id": 13, "name": "hebei ", "color": 0 xbbffbb, "hoverColor": 0xffff00}, 37 {"id": 14, "name": "shanxi", "color": 0xffee00, "hoverColor ": 0xff2200}, 38 {"id": 15, "name": "neimenggu", "color": 0 xaaffaa, "hoverColor": 0xff2200}, 39 {"id ": 21, "name": "liaoning", "color": 0 xddffdd, "hoverColor": 0xff2200}, 40 {"id": 22, "name": "jilin ", "color": 0 xddffdd, "hoverColor": 0xff2200}, 41 {"id": 23, "name": "heilongjiang", "color": 0 xddffdd, "hoverColor": 0xff2200}, 42 {"id": 31, "name": "shanghai", "color": 0 xddffdd, "hoverColor": 0xff2200 }, 43 {"id": 32, "name": "jiangsu", "color": 0 xddffdd, "hoverColor": 0xff2200}, 44 {"id": 33, "name": "zhejiang", "color": 0 xddffdd, "hoverColor": 0xff2200}, 45 {"id": 34, "name": "anhui ", "color": 0 xddffdd, "hoverColor": 0xff2200}, 46 {"id": 35, "name": "fujiian", "color": 0 xddffdd, "hoverColor": 0xff2200}, 47 {"id": 36, "name": "jiangxi", "color": 0 xddffdd, "hoverColor": 0xff2200 }, 48 {"id": 37, "name": "shandong", "color": 0 xddffdd, "hoverColor": 0xff2200}, 49 {"id": 41, "name": "henan", "color": 0 xddffdd, "hoverColor": 0xff2200}, 50 {"id": 42, "name": "hubei ", "color": 0 xddddff, "hoverColor": 0xff2200}, 51 {"id": 43, "name": "hunan", "color": 0 xddffdd, "hoverColor": 0xff2200}, 52 {"id": 44, "name": "guangdong", "color": 0 xddffdd, "hoverColor": 0xff2200 }, 53 {"id": 45, "name": "guangxi", "color": 0 xddeeff, "hoverColor": 0xff2200}, 54 {"id": 46, "name": "hainan", "color": 0 xddffdd, "hoverColor": 0xff2200}, 55 {"id": 50, "name": "chongqing ", "color": 0 xddffdd, "hoverColor": 0xff2200}, 56 {"id": 51, "name": "sichuan", "color": 0 xffffdd, "hoverColor": 0xff2200}, 57 {"id": 52, "name": "guizhou", "color": 0 xddffdd, "hoverColor": 0xff2200 }, 58 {"id": 53, "name": "yunnan", "color": 0 xddffdd, "hoverColor": 0xff2200}, 59 {"id": 54, "name": "xizang", "color": 0 xddeffe, "hoverColor": 0xff2200}, 60 {"id": 61, "name": "shannxi ", "color": 0 xddffdd, "hoverColor": 0xff2200}, 61 {"id": 62, "name": "gansu", "color": 0 xddffdd, "hoverColor": 0xff2200}, 62 {"id": 63, "name": "qinghai", "color": 0 xddffdd, "hoverColor": 0xff2200 }, 63 {"id": 64, "name": "ningxia", "color": 0 xddffdd, "hoverColor": 0xff2200}, 64 {"id": 65, "name": "xinjiang", "color": 0 xddffdd, "hoverColor": 0xff2200}, 65 {"id": 71, "name": "taiwan ", "color": 0 xddffdd, "hoverColor": 0xff2200}, 66 {"id": 81, "name": "xianggang", "color": 0 xddffdd, "hoverColor": 0xff2200}, 67 {"id": 82, "name": "aomen", "color": 0 xddffdd, "hoverColor": 0xff2200} 68]; 69 map. init (initData); 70} 71 72]> 73 </fx: Script> 74 <s: Group id = "test"> 75 76 </s: group> 77 </s: Application>
Download Demo
You can directly import a project whose Demo is Flash build 4.5.