摘要:Flash中国地图,以Object为数据源,便于实现基于中国地图的可视化项目。
Flash中国地图,以Object为数据源,便于实现基于中国地图的可视化项目。
特征:
swc,便于导入到Flex项目中
数据源为Object,比XML更方便
数据驱动的地图块颜色和Hover颜色
可配置是否显示省份名
快速方便
Code License: Apache 2.0
Author: ComingX Jingle
Download: Git Repo
使用方法:
创建Flex项目,拷贝ChinaMap.swc至项目libs目录下
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="//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_creationCompleteHandler(event)"15 >16 <fx:Declarations>17 <!-- 将非可视元素(例如服务、值对象)放在此处 -->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_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":0xccffcc,"hoverColor":0xff0000},36 {"id":13,"name":"hebei","color":0xbbffbb,"hoverColor":0xffff00},37 {"id":14,"name":"shanxi","color":0xffee00,"hoverColor":0xff2200},38 {"id":15,"name":"neimenggu","color":0xaaffaa,"hoverColor":0xff2200},39 {"id":21,"name":"liaoning","color":0xddffdd,"hoverColor":0xff2200},40 {"id":22,"name":"jilin","color":0xddffdd,"hoverColor":0xff2200},41 {"id":23,"name":"heilongjiang","color":0xddffdd,"hoverColor":0xff2200},42 {"id":31,"name":"shanghai","color":0xddffdd,"hoverColor":0xff2200},43 {"id":32,"name":"jiangsu","color":0xddffdd,"hoverColor":0xff2200},44 {"id":33,"name":"zhejiang","color":0xddffdd,"hoverColor":0xff2200},45 {"id":34,"name":"anhui","color":0xddffdd,"hoverColor":0xff2200},46 {"id":35,"name":"fujian","color":0xddffdd,"hoverColor":0xff2200},47 {"id":36,"name":"jiangxi","color":0xddffdd,"hoverColor":0xff2200},48 {"id":37,"name":"shandong","color":0xddffdd,"hoverColor":0xff2200},49 {"id":41,"name":"henan","color":0xddffdd,"hoverColor":0xff2200},50 {"id":42,"name":"hubei","color":0xddddff,"hoverColor":0xff2200},51 {"id":43,"name":"hunan","color":0xddffdd,"hoverColor":0xff2200},52 {"id":44,"name":"guangdong","color":0xddffdd,"hoverColor":0xff2200},53 {"id":45,"name":"guangxi","color":0xddeeff,"hoverColor":0xff2200},54 {"id":46,"name":"hainan","color":0xddffdd,"hoverColor":0xff2200},55 {"id":50,"name":"chongqing","color":0xddffdd,"hoverColor":0xff2200},56 {"id":51,"name":"sichuan","color":0xffffdd,"hoverColor":0xff2200},57 {"id":52,"name":"guizhou","color":0xddffdd,"hoverColor":0xff2200},58 {"id":53,"name":"yunnan","color":0xddffdd,"hoverColor":0xff2200},59 {"id":54,"name":"xizang","color":0xddeffe,"hoverColor":0xff2200},60 {"id":61,"name":"shannxi","color":0xddffdd,"hoverColor":0xff2200},61 {"id":62,"name":"gansu","color":0xddffdd,"hoverColor":0xff2200},62 {"id":63,"name":"qinghai","color":0xddffdd,"hoverColor":0xff2200},63 {"id":64,"name":"ningxia","color":0xddffdd,"hoverColor":0xff2200},64 {"id":65,"name":"xinjiang","color":0xddffdd,"hoverColor":0xff2200},65 {"id":71,"name":"taiwan","color":0xddffdd,"hoverColor":0xff2200},66 {"id":81,"name":"xianggang","color":0xddffdd,"hoverColor":0xff2200},67 {"id":82,"name":"aomen","color":0xddffdd,"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>
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标常用软件Flash频道!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号