I’ve been working on a Flex 2 component which exposes the Yahoo! Maps API similar to the official Flex 1.5 version. There seems to be a lot of interest in getting an official, updated version of the maps API and in the meantime several people have blogged about ways of communicating to a Flash 8 SWF which contains the Yahoo! Maps Flash component.

I played around with this a while back going with the ExternalInterface approach. I’ve since dumped that approach in favor of using LocalConnection. I’ve encapsulated all the communication into a Flex 2 component which you can just drop into your Flex application. I’m going to be finishing up a few things on it this weekend after which I’ll release the component, along with source. I’m posting a preview of it now to see how much interest there is in the project. The first release of the component will only expose the most common API elements and then I’ll plan out a roadmap for adding more of the Flex 1.5 API.

You can view the demo here:
http://timwalling.com/sandbox/flexmap/preview/

The code for the demo:

XML
<view:YahooMap id="map"
    width="500" height="400"
    source="flash/map.swf"
    mapViewType="{com.timwalling.maps.MapViews.MAP}"
    zoomLevel="6"
    latitude="37.77159"
    longitude="-122.451714"
    mapInitialize="onInit(event)"
/>

Since all of the communication is taken care of by the component, you should be able to use the component just like the Flex 1.5 version using all of the standard map events and map methods.

Update:
I’m open to project name ideas. For obvious reasons, I won’t be keeping the component name “YahooMap”.

16 Responses to “Yahoo! Maps Flex 2 Component - Preview”

  1. Mike Says:

    Hi Tim,

    Very cool! Will this be open source? Also, your demo is missing the District of Columbia from the state combobox.

    Mike

  2. Tim Says:

    Yes this will be an open source project.

    Thanks for pointing out that DC was missing. I actually deleted it from my array because it was making my ComboBox too wide. I’ll put it back in.

  3. Mrinal Wadhwa Says:

    Awesome!!!
    I was thinking of doing the same thing … can’t wait to get my hands on the source.

    And .. if its ok with you … once you do have the source ready … I would like to get it up on FlexBox

    Keep up the good work.

  4. Joe Rinehart Says:

    Thanks man! I’ve been hoping to see something like this come along. Any ETA?

  5. Tim Says:

    I’ll be releasing the first version over the weekend. I want to document the code I have now and create a page to host the package along with examples.

  6. John Says:

    Very nice implementation, Tim, and I appreciate all the work you’ve done on Yahoo’s behalf. :)

    So to put markers down, remove them, etc., that’s something we can call within Flex 2/AS3?

  7. Tim Says:

    Adding and removing of markers is the last thing I want to get in before the first release. So yes, you’ll be able to do all of that from Flex 2/AS3.

    I’ll make sure to document what’s supported in the first release, along with a tentative roadmap for the features that I plan on adding. I haven’t really used the Yahoo! Maps API a lot myself, so I’d be interested to hear from people on the parts of the API they use the most.

  8. Shan Says:

    I have a hunch that Yahoo! will be releasing the official AS3 API on Monday at 360Flex. They are scheculed to demonstrate all the new AS3 API’s.

  9. Tim Says:

    Well then I better release mine before they do. :)

  10. Tim Says:

    I’m willing to bet that a Flex 2 version of the maps API is *not* released next week. There are already a number of Yahoo! API’s currently available to Flex 2 developers and I’m guessing that the sessions will be going over these.

  11. ashif Says:

    I’m using yahoo maps right now in a project and using localconnection to talk from Flex2. I use the setBounds and getBounds calls a lot to set my map extents.

    As soon as you release the source, I’d be glad to dive in and help out.

    thanks,
    Ashif

  12. Brude Says:

    This is very cool. I’m looking forward to your further updates! Great work.

  13. Douglas McCarroll Says:

    This is exciting. I’ve been waiting to dive into playing with Flex mapping, hoping that Yahoo or Google would come out with a Flex 2.0 API soon. Now I can start to play now. :-) Thanks, Tim!

  14. thecleanmachine Says:

    Hi, I’m really glad you are doing this. I started looking into getting Yahoo Maps working with Flex 2 just this weekend and it looks like you will be releasing this sometime today - is this right?

    Now I don’t have to go through the other method of using the local connection .. yeah!

  15. ajnabi Says:

    Hey ,
    Great work! I am also trying to make the Flex 1.5 map available to Flex 2. However, encountered few problems with the focus issues. Maybe your component do not have those problems.
    Is this component open source? Where is the source code for it? If its open source and the source code is made available I would like to play with it.

  16. Tim Says:

    Yes, it’s open source. You can read more on the page for it.

    http://timwalling.com/flexmap/

    I’ve discontinued the project though as Yahoo ended up releasing an updated API to get maps working in Flex 2.

Leave a Reply