Tom Lauck’s Deseloper.org

Modest Maps: Yahoo Style Flex Component Markers

author:

View example and download source.

History

Creating software with mapping should be a figurative walk in the park given the tools available from the major map api players like Google and Yahoo. However, when creating software on the Flash platform that needed mapping, my immediate choice was to go with Yahoo, since they have a history of being Flash friendly.

After investigating and implementing the examples Yahoo providing using the ASTRA Web Api, and in the end the solution as a whole seemed to work, albeit not as robust or simple as I would have liked. All was apparently well until production time. Once I deployed to the web, with a DOCTYPE of xhtml-transitional, the map ceased to dispatch the onMapLoad event.

As an alternate AS3/Flex solution I discovered Modest Maps. The hitch was that using Modest Maps would require building custom own components (such as Zoom, Map Types, Markers, Etc), for modest maps displays the map only.

Solution

I really take a liking Yahoo’s map markers. There was a hitch, Modest Maps was written in AS3 only. Therefore, when I went to integrate a Flex based marker into the map, the two were incompatable.

My solution:

  • Reworked the Modest Maps core to use FlexSprite and UIComponent (which inherits FlexSprite).
    • As a site note: I’m not sure that was completely necessary and would have rather not touched the core, but I was in get’er done mode.
  • Built a marker that looked an functioned like Yahoo’s, with the ability to add any flex component inside.
  • Created some events that bubble up when the user clicks inside the marker.
  • Created functionality to open a selected marker, based on its Id.

I see my work as a mere starting point. As Google states, “release early, release often.” So, please view the example, download the source and play. I would love to see where things go with it, if any.

38 Responses

date: March 13th, 2008

Great work! This was very helpful for me in getting up and running with my own markers.

Also, I appreciated your creativity with the JSON class. It gave me insight
into how I could extend HttpService for my own JSON needs.

I used the mx.rpc.http.mxml.HTTPService version (as opposed to mx.rpc.http.HTTPService;)
to incorporate the showBusyCursor functionality.

spoken by: jking

date: March 13th, 2008

hi,Tom:
I come from China
I’m downlaod the source code.It run fine.
But It can’t show marker,when update the modestMaps.

The old code is:
public function putMarker(id:String, location:Location, marker:UIComponent=null):void
now it changed:
public function putMarker(location:Location, marker:DisplayObject=null):void

spoken by: mreay

date: March 14th, 2008

Great work! I’m trying to “steal” your custom marker for the AS3 Yahoo Maps in Adobe AIR… I hope you don’t mind that I reuse the marker you’ve made.

Keep up the great work!

spoken by: Michael van Leest

date: March 14th, 2008

@mreay:
As I stated in my explanation, my solution was only possible by getting the modifying the ModestMaps core:

  • Reworked the Modest Maps core to use FlexSprite and UIComponent (which inherits FlexSprite).
    • As a site note: I’m not sure that was completely necessary and would have rather not touched the core, but I was in get’er done mode.

DisplayObject and Sprite are part of the the Flash core. Flex extends the Flash core to FlexSprite and UIComponent so that things like Containers and Canvas are possible. And an mxml marker is some sort of Container usually.

I would be very interested in another solution, as I generally don’t like to edit core files. In this case, the core didn’t seem totally optimized for Flex.

spoken by: tom

date: November 17th, 2008

Can we feed the data using XML?

spoken by: Nuwan

date: November 29th, 2008

@Nuwan Yes, but it you will have to make some modifications. For instance, the service I am using is set up for JSON. The built in Flex HTTPService will likely do what you need.

spoken by: tom

date: December 3rd, 2008

Hi really this is awesome!!!

spoken by: Arthi

date: May 5th, 2009

Very nice. What is the “active content that could access your computer” when I run it in IE6. (I have seen your article about IE6 people, so I have my shield up!) I am relatively new to Flex/Flash, so this example of Modest Maps has been a big help. Thanks.

spoken by: Larry

date: September 14th, 2010

hey, i’m using your component and when i compile it none of the markers show up. any ideas?

spoken by: anton

date: April 16th, 2012

Another thing to consider to buy a business is to employing a lawyer. In purchase to make your purchase as secure as achievable, it is a enormous reward to have your possess lawyer throughout the total method. This not only scares absent anybody who calculatedly misrepresents what they are selling, but it also ensures that you receive every thing that you require. Enterprise lawyers, specially types with experience in world wide web business product sales, presently know what you should be acquiring in conditions of electronic and rational house. They can also make sure that all of the correct paperwork and documentation is signed at the time of sale. Even if you do not want to pay out a attorney to be at your facet by way of the total process, you ought to at least have a single appear more than all of the closing paperwork prior to the transaction is completed.

spoken by: Free of charge

date: June 24th, 2012

UEFA EURO 2012 SOUVENIR FOR ALL TIME NOW AVAILABLE ONLINE |

spoken by: Juli Boyles

date: November 27th, 2012

I guess, it comes down to 23740 simple choice!

spoken by: dresses

date: September 15th, 2015

whoah this weblog is wonderful i like reading your articles. Stay up the good work! You know, lots of people are hunting around for this information, you could aid them greatly.

spoken by: business ethics

date: September 20th, 2015

You made some clear points there. I looked on the internet for the subject and found most guys will go along with with your blog.

spoken by: transportation technology

date: September 20th, 2015

I¡¦ve recently started a blog, the info you provide on this site has helped me greatly. Thanks for all of your time & work.

spoken by: home designer

date: October 9th, 2015

Hello there anyone in this article, the is several opinion referring to something here, hello administrative you should remove all those review!

spoken by: séjour plongée aux maldives

date: October 11th, 2015

Fantastic web site. Lots of valuable info here. I am sending it to some friends ans additionally sharing in delicious. And naturally, thank you to your effort!

spoken by: books

date: October 31st, 2015

Numerous thanks I ought say, impressed with your website. I will post this to my facebook wall.

spoken by: Pinoy Teleseryes

date: October 31st, 2015

I’m not certain specifically why but this weblog is loading exceptionally slow for me. Is everyone else having this problem or is it an issue on my finish? I’ll verify back later on and see if the issue still exists.

spoken by: Which Pull Up Bar

date: November 8th, 2015

This may possibly be the correct blog for everybody who is wishes to learn about this subject. You already know much its practically challenging to argue to you (not too I personally would want…HaHa). You certainly put a whole new spin over a topic thats been revealed for several years. Wonderful stuff, just wonderful!

spoken by: Flexstrom

date: November 9th, 2015

I precisely had to appreciate you once again. I am not sure the things that I would’ve carried out in the absence of these recommendations provided by you regarding such a topic. This was a scary dilemma in my position, nevertheless witnessing a new skilled way you solved that forced me to jump over contentment. I’m grateful for this guidance and in addition pray you are aware of an amazing job you are undertaking instructing people today thru your webblog. I know that you’ve never got to know any of us.

spoken by: juvenile justice

date: December 29th, 2015

What your saying is completely proper. I know that all people must say the incredibly exact exact same concern, but I just presume that you place it in a way that everyone can totally grasp. I also essentially like the photographs you position within the adhering to. They match so nicely with what youre attempting to say. Im guaranteed youll accomplish so fairly a couple of guys and girls with what youve acquired to say.

spoken by: global-hegn

date: January 22nd, 2016

Thank you for sharing with us, I believe this site genuinely stands out : D.

spoken by: o sureyi kaldir anani sikerim senin

date: February 17th, 2016

Hі thеге tߋ ɑⅼⅼ, ѕіncᥱ I am in fact еаցeг օf гeadіng tһіs
ѡеƄρɑǥе’s pߋѕt tο
Ье ᥙρԁatеⅾ οn a геǥᥙⅼɑг ƅɑѕiѕ.
Ιt іncⅼսɗеѕ nicе matегiaⅼ.

spoken by: homepage

date: March 21st, 2016

Some truly marvelous work on behalf with the owner of this internet website , dead great articles .

spoken by: disabiled bathroom fitter sheffield

date: May 2nd, 2016

Although all of these symptoms may be experienced by all women,
the name CFS is applied when the situation appears in a previously healthy woman. The best way is turning off all these devices before going to
bed. Certainly fatigue can be expected at all times therefore the staff members must have the
education on how to stop such circumstances or maybe cope with this anytime it.

spoken by: Fatigue

date: May 2nd, 2016

That doesn’t mean that you should go and fill up on chocolate bars,
chips and candy (even though it’s tempting. Understand
that healing the adrenals, or balancing any hormones,
can take time; it is not a quick fix. cleaning the floors and carpets with the automatic floor cleaner.

spoken by: Fatigue

date: May 6th, 2016

With thanks for sharing this fantastic web site

spoken by: madden coins

date: May 12th, 2016

Many thanks, this site is really useful

spoken by: nba vc coins

date: June 2nd, 2016

Allow me to start by expressing great article. Internet marketing unsure in case it’s been spoke of, although when you use Chrome I could never have the overall web site for you to weight without exhilarating many times. Might be my own laptop or computer. Thanks.

spoken by: Liam Pullman

date: June 15th, 2016

Great looking web site. Think you did a great deal of your ownyour very own coding

spoken by: counter strike

date: June 15th, 2016

Just needed to stress I am just delighted that i happened onto your website!.

spoken by: cs:go

date: June 15th, 2016

Thanks pertaining to giving this sort of good content

spoken by: cs:go

date: June 19th, 2016

Great internet site! It looks very professional! Keep up the great work!

spoken by: buy csgo

date: December 3rd, 2016

Nice blog here! Also your website rather a
lot up very fast! What host are you the use of? Can I am getting your associate hyperlink for your host?

spoken by: Morning desert safari

date: January 15th, 2017

If you want to grow your know-how only keep visiting this web
page and be updated with the newest information posted
here.

spoken by: desert safari

date: January 29th, 2017

Hmm іt seеms ⅼike yoᥙr site ate my first commеnt (it waѕ super ⅼong) soo I guess
Ӏ’ll jᥙѕt sum it up whɑt I hadd writtеn and ѕay, I’m thorоughly enjoyingg ykur
blog. I too ɑm an aspiring blog writer ƅut I’m ѕtiⅼl
new to evеrything. Ɗο үou Һave аny tips and hints for newbie
blog writers?Ⅰ’ɗ genuinely ɑppreciate it.

Feel free toо visit my blog health

spoken by: health

date: February 21st, 2017

I feel this is among the mοst vital info for me. And
i am happy studying yoᥙr article. However want tօ remark οn few general tɦings, The website styⅼe is wonderful, the articles is
actually excellent : D. Excellent prοcess, cheᥱrs

spoken by: Dorcas

Leave a Reply

Jan 1 2008