Flex 2.0 and Yahoo Maps
来源:互联网 发布:辐照食品 知乎 编辑:程序博客网 时间:2024/06/07 08:37
Flex 2.0 and Yahoo Maps
If you are programming in Flex, it looks like the only native maps solution is Yahoo Maps. However Yahoo so far has been very slow to update their Flex 1.5 (Actionscript 2.0) based API to Flex 2.0 (Actionscript 3.0). Instead they created a wrapper on top of the existing Flex 1.5 based ones.
I downloaded these wrappers, followed the installation instructions. However the first problem, I ran into was the fact that there was really no easy way to make the map 100% in size and make it resizable as you resize the browser window. All the samples were given for a fixed sized map and simply making the size 100% instead did not work. A quick search on Google revealed the same problem experienced by others as well, and the solution provided there was not really robust.
The problem is that the map itself needs to be explicitly resized and there appears to be no method exposed in AS3 to do that, whereas the AS2 version does have method called Map.setSize. This is also exposed as a method called setMapSize as an ExternalInterface and it is distributed in the “as2map.fla” file. However it looks like they forgot to expose it in the wrappers. To fix this, I added the following to the “YahooMapService.as” file as a method of the YahooMapService class as shown below:public function setMapSize(width:Number, height:Number): void {
EIBuffer.addCall({method:swfDomId + ".setMapSize" + UUID, data:{w:width,h:height}});
}
The next step is to handle the resizing related events in the Flex application to call this method whenever a resize happens. Note that this solution does not allow live resizing, as you will have to explicitly call this method whenever a resize event completes.
For the overall application I handle the creationComplete and updateComplete events. Note that onResize event is not the correct event to handle as the sizes of all components are not computed yet and you would get incorrect results. Here is the code for the test application that I created for this.
- Flex 2.0 and Yahoo Maps
- Yahoo!Maps 指南
- Yahoo! Maps Mashups
- 使用 Yahoo! Maps Flash API
- 震撼:Google, Microsoft, Yahoo Maps
- Google Maps + Flex Mobile
- Yahoo!Maps Flash APIs(3種類)
- Yahoo! and FreeBSD
- Microsoft and Yahoo!【经济学家】
- Android Location and Maps
- Configuring Class Maps and Policy Maps
- yahoo pop3 and smtp settings
- Pig and Hive at Yahoo!
- 在Flex程序中插入Yahoo!地图
- How Many Maps And Reduces
- AS4 and AS5 key maps
- Lighting Models and BRDF Maps
- Shape Correspondence and Functional Maps
- ERP如何帮助服装企业实现渠道扁平化?
- 页面被css内嵌javascript搞死了
- FCKeditor在ASP环境中配置使用
- 完全优化MySQL数据库性能的八大巧方法
- .NET多线程同步方法详解(七):线程池(Thread Pooling)
- Flex 2.0 and Yahoo Maps
- NET Framework 类库 String.IsNullOrEmpty 方法
- 软件可重用性的一点思考
- 关于服务编程中禁止“停止”或“暂停”选项的问题
- 自己做的一个类似MSN弹出消息的框框的自定义控件
- 名词あ段から
- 获取GridView 中隐藏列中的值
- Microsoft Agent动画精灵人物解析
- mysql_connect()连接时出现这种错误?