Tim Walling

technology is good

FlexMap

leave a comment

FlexMap – Yahoo! Maps component for Flex 2

FlexMap allows a developer to use the Yahoo! Maps API in their Flex 2 projects. The solution brings together a Flash 8 SWF which contains the Flash API for Yahoo! Maps and a Flex 2 component which communicates to the SWF via LocalConnection. The Flex 2 component exposes similar properties, events and methods as the official Flex 1.5 component.

Download FlexMap 0.4.0

Project site for source code and issue tracking:
http://code.google.com/p/flexmap/

Notes

  • Currently if you’d like to resize the map, it’s best to republish the SWF with the new dimensions vs calling the setSize method. I encountered very odd behavior when using it. Something I have to look into more.
  • There seems to be an issue with clicking on CustomPOIMarkers. I’m guessing that the Flex app is intercepting the click which then prevents the SWF from getting it. Another thing I have to look into.
  • You can set your application id in the provided FLA, then republish or call setAppId() on your FlexMap instance.

Documentation

Supported methods

addMarkerByAddress(markerClass:Class, address:String, data:Object):void

addMarkerByLatLon(markerClass:Class, latlon:LatLon, data:Object):void

addTool(tool:Tool, isActive:Boolean):void

addWidget(widget:Widget):void

removeAllMarkers():void

setAppId(appid:String):void

setBounds(rect:LatLonRect):void

setCenterByAddress(address:String, duration:Number=0):void

setCenterByAddressAndZoom(address:String, zoomLevel:Number, duration:Number=0):void

setCenterByLatLon(latlon:LatLon, duration:Number=0):void

setCenterByLatLonAndZoom(latlon:LatLon, zoomLevel:Number, duration:Number=0):void

setMapViewType(mapViewType:String):void

setSize(newWidth:Number, newHeight:Number):void

setZoomLevel(zoomLevel:Number):void

Supported properties

mapViewType:String

zoomLevel:Number

latitude:Number

longitude:Number

Displaying a Yahoo! Map
Once downloaded, add the SWC to your application by creating a new library reference in your project settings. The included Flash SWF which contains the Yahoo! Maps flash component will also need to be copied into your project or placed on the server where your application will run.




  

Making the map draggable



  
    
  

Changing the map view type
To change the type of map being displayed, set the mapViewType property after the map has loaded.



  
    
  

Adding a navigation widget
To give users control over the map zoom level, add a navigation widget by calling the addWidget method.



  
    
  

Adding custom point of interest markers
To place a point on the map, you can call the addMarkerByAddress or addMarkerByLatLon methods. Each method needs to know the type of marker to add, the location (address or LatLon object) and an object containing the parameters to pass to the marker class.



  
    
  

Issues/Bugs

Issues and bugs can be reported at the project’s home on code.google.com:
http://code.google.com/p/flexmap/

Feature Roadmap (coming soon)

Questions

Feel free to contact me with any other questions or comments.

 

Written by Tim

March 4th, 2007 at 11:31 pm

Posted in Misc.