我正在从事一个flash项目,这需要我使用谷歌地图。我读到一篇文章说"Google Maps API for Flash已于2011年9月2日正式弃用“。我的问题是,有没有可能在flash项目中嵌入google地图的javascript版本?我的另一个问题是,有没有人知道我可以用来制作flash的地图工具,这些工具可以提供与谷歌地图相同的质量,并且仍然受到支持?谢谢。
发布于 2013-02-23 00:47:48
我有同样的需求,但也找不到一个好的现成的解决方案,所以我编写并注释了下面的测试库,它可以作为任何类似项目的基础。
我没有依赖于单一的提供商,而是在必应地图V7、谷歌地图V3和MapQuest地图V7 JavaScript地图上实现了相同的功能。代码创建线条、动态标记和阴影等,并调用它们的立面apis。示例应用程序在一个html页面中创建每种地图类型的两个。
要做到这一点,你需要让闪存和JavaScript通过注册函数来调用彼此的数据和/或闭包,这些函数具有唯一的名称。
首先,每个map都有一个唯一的mapId,并且每个map MXML组件使用其唯一的mapId (例如fname_mapId)注册一组外部方法,然后使用参数化的src HTML为传递mapId、应用程序名称、起始位置等三种map类型之一创建一个Flex-iFrame。
HTML读取这些参数并通过应用程序名称从父框架中获取SWF对象。它创建一个map并向map注册侦听器,并使用其mapId (例如fname_mapId)向父框架添加回调,这些回调允许创建标记和线条,每个标记和线条都具有唯一的id,并再次向父框架注册函数,这些函数现在也在其名称中包含标记或线条id (例如fname_mapId_lineId|markerId),允许设置图标、阴影、线条颜色以及它们的位置更改或删除。
通常,超文本标记语言还通过mapId注册函数以检查位置或路径的高程。这些函数调用ajax或例程来请求提升,回调JavaScript,然后回调AS3注册函数。
-C
测试操作和回调中的逻辑-设计用于测试所有实现的功能:
Double click on map:
Create pin:
- Set to default name
- Add to map
- Set icon and shadow (note Bing does not take shadows; Google can take a marker mask for clicking - not implemented)
- Call to map for elevation
Remove previous marker
Log current markers (should be only 1)
Create black line from start to pin:
- Change line color to blue
- Call to map for path elevation
Remove previous line
Log current lines (should be only 1)
Drag marker:
Start:
- only logs it was called
Drag:
- only logs it was called
End:
- Move line to new lat lng
- Set line color to orange
- Sets map to not accept double clicks
Double click marker:
- Sets map to accept double clicks again (so after you drag you need to double click a marker to have map accept double clicks again)
Elevation callback:
- Changes pin name to include elevation in name
- Sets new icon and shadow for marker
Elevation path callback - set to 300m & 500m - is balloon at 500m on path going to hit? - error if elevation of path >=500, warn if >=300
- Sets line color if path max elevation as sampled is:
Purple: elevation request error flag set
Red: at or above error level
Red-Yellow: at or above warning but requested distance not met
Yellow: at or above warning level
Yellow-Green: below warning level but requested distance not met
Green: below warning level这篇文章代码的其余部分太长了,有太多的链接,所以我不得不把它们都放在这里-复制到纯文本编辑器-代码都是用空格很好地格式化的:http://pastebin.com/Jzq5E06F
https://stackoverflow.com/questions/14725861
复制相似问题