How embed Google Maps in Flex?


Google create a special API for Flash platform to make possible use them. I will show how write a simple application to find a place or route. At first we need a special key from Google for use the map (http://code.google.com/intl/pl/apis/maps/signup.html ). When we have the key we can start.

  1. add xmlns:maps=”com.google.maps.*” to Application tag
  2. import appropriate classes
  3. add map instance
  4. <maps:Map id="myMap" width="100%" height="100%"  key="[key from the google site]" mapevent_mapready="onMapReady(event)" url="[url to our site]"/>
  5. add functions
private function onMapReady(event:MapEvent):void {
	myMap.addControl(new MapTypeControl());							//add type of map control
	myMap.addControl(new ZoomControl());							//add zoom control
	myMap.enableScrollWheelZoom();								//enable mouse scrolling
	geocoder=new ClientGeocoder();								//create geocoder
	geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS, handleGeocodingSuccess);	//add listeners for geocoder
	geocoder.addEventListener(GeocodingEvent.GEOCODING_FAILURE, handleGeocodingFailure);
	dirs=new Directions();									//create directions
	dirs.addEventListener(DirectionsEvent.DIRECTIONS_SUCCESS, handleDirLoad);		//add listeners for directions
	dirs.addEventListener(DirectionsEvent.DIRECTIONS_FAILURE, handleDirFail);

}

private function handleDirLoad(evt:DirectionsEvent):void{
	var dirs:Directions=evt.directions; 							//create directions from event
	var startM:Marker;
	var endM:Marker;
	startM = new Marker(dirs.getRoute(0).startGeocode.point, new MarkerOptions());		//create start marker from directions instance
	endM = new Marker(dirs.getRoute(0).endGeocode.point, new MarkerOptions());		//create end marker from directions instance
	myMap.clearOverlays();									//clear map
	myMap.addOverlay(dirs.createPolyline());						//draw route on map
	myMap.addOverlay(startM);								//add start marker
	myMap.addOverlay(endM);									//add end marker
	myMap.setZoom(myMap.getBoundsZoomLevel(dirs.bounds));					//set appropriate zoom
	myMap.setCenter(dirs.bounds.getCenter());						//show route
}

private function handleDirFail(evt:DirectionsEvent):void{					//directions failure handler
	Alert.show("Unable to found route");
}

private function handleGeocodingSuccess(evt:GeocodingEvent):void{				//geocoding success handler
	var result:Placemark = GeocodingResponse(evt.response).placemarks[0];			//create result object
	myMap.setCenter(result.point, 14);							//show finding place
}

private function handleGeocodingFailure(evt:GeocodingEvent):void{				//geocoding failure handler
	Alert.show("Unable to found: " + evt.name);
}

This is one out of many things we can do with GoogleMaps API, including e.g. adding information and photos in concrete places on the map.

  1. #1 by business to wealth at November 20th, 2016

    Oh my goodness! Impressive article dude! Many thanks, However I am
    encountering problems with your RSS. I don?t know the reason why I am unable to subscribe to it.
    Is there anyone else getting identical RSS problems?

    Anyone that knows the solution will you kindly respond?

    Thanx!!

  2. #2 by alumni.sandybros.org at November 21st, 2016

    When the very first outbreak of herpes is moderate and another outbreak
    happens years later on, the person can error it for a first break out.

  3. #3 by happy plugs rabattkod at November 27th, 2016

    I am actually delighted to read this website posts which consists of lots of
    valuable facts, thanks for providing these kinds of statistics.

  4. #4 by inspection du travail les milles at November 28th, 2016

    Thanks for sharing your thoughts about sfr sin le noble.
    Regards

  5. #5 by cytotec at November 30th, 2016

    I got this web site from my pal who informed me concerning this website and now this time I am visiting this
    website and reading very informative articles or reviews at this place.

  6. #6 by como engravidar no the sims 4 at December 2nd, 2016

    Construções do feminino pós anos sessenta: caso da maternidade como produção independente.

  7. #7 by credit agricole bonneville at December 5th, 2016

    Nice post. I used to be checking constantly this weblog and I am impressed!

    Extremely useful info particularly the remaining part :) I care for such info
    a lot. I used to be seeking this particular info for a long time.
    Thank you and good luck.

  8. #8 by telefoonnummer eneco gratis at December 5th, 2016

    Good site you have got here.. It’s difficult to
    find high quality writing like yours these days. I truly appreciate
    individuals like you! Take care!!

  9. #9 by rabattkod elgiganten at December 5th, 2016

    Wow! At last I got a webpage from where I be able to truly obtain valuable information concerning my study and knowledge.

  10. #10 by tipos de planchas para el cabello at December 5th, 2016

    Excellent article. I will be experiencing many of these issues as well..

  11. #11 by tajwan gan at December 9th, 2016

    I’ve learn a few good stuff here. Certainly worth bookmarking for revisiting.
    I surprise how a lot attempt you place to create such a
    excellent informative site.

  12. #12 by solentbay at December 9th, 2016

    you’re in point of fact a good webmaster. The website loading pace is amazing.
    It kind of feels that you are doing any unique
    trick. Furthermore, The contents are masterwork.
    you have performed a excellent activity in this topic!

  13. #13 by telephone inverse gratuit at December 9th, 2016

    Excellent website. A lot of useful information here.
    I am sending it to several buddies ans additionally sharing in delicious.
    And obviously, thanks on your sweat!

  14. #14 by bambin deco at December 9th, 2016

    Thank you for another excellent article. Where else could anyone get that kind
    of information in such an ideal manner of writing?
    I’ve a presentation next week, and I’m at the look for
    such information.

  15. #15 by Aspirateur Robot neato at December 11th, 2016

    Enfin, Samsung a présenté lors du dernier CES une model améliorée du Powerbot qui est également connectée (commercialisation en France annoncée courant 2016).

  16. #16 by strefamocy at December 11th, 2016

    An interesting discussion is worth comment.

    I think that you need to write more about this issue, it might not be a taboo matter
    but generally folks don’t talk about such topics. To the next!
    Cheers!!

  17. #17 by Matkapuhelinluettelo at December 12th, 2016

    Thanks for any other informative site. The place
    else may I get that type of info written in such an ideal approach?

    I have a project that I am simply now working on, and
    I have been on the glance out for such info.

  18. #18 by numero aeroport marignane at December 12th, 2016

    What’s Going down i’m new to this, I stumbled upon this
    I’ve found It absolutely useful and it has helped me out loads.

    I am hoping to give a contribution & aid different customers like
    its aided me. Great job.

  19. #19 by Directorio telefónico at December 18th, 2016

    Wow! In the end I got a blog from where I can actually get valuable
    facts regarding my study and knowledge.

  20. #20 by elis nimes at December 18th, 2016

    Hello to every body, it’s my first go to see of this weblog; this web site consists of awesome and really good stuff for readers.

  21. #21 by numéros inversés gratuits at December 18th, 2016

    Right now it looks like Drupal is the top blogging
    platform out there right now. (from what I’ve read) Is that what
    you are using on your blog?

  22. #22 by NMD Adidas at December 19th, 2016

    As I website owner I conceive the articles here is very
    superb, thank you for your efforts.

  23. #23 by site web at December 22nd, 2016

    Hello this is somewhat of off topic but I was wanting to
    know if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding knowledge so
    I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

  24. #24 by gizli kamera kalem hd at December 23rd, 2016

    Bu fonksiyonların en önemli gelişmelerinden biri 140 derecelik geniş
    kamera açısıdır.

  25. #25 by http://www.blogigo.com/attractingwomen00/10-Basic-Steps/1 at December 28th, 2016

    Miller stated he called an ambulance to obtain his
    sweetheart aid, but while they were waiting she passed out.

  26. #27 by my post at December 31st, 2016

    Pretty great post. I simply stumbled upon your
    weblog and wished to say that I’ve truly loved browsing your blog posts.
    After all I’ll be subscribing for your rss feed and I hope you write again soon!

  27. #28 by now at January 18th, 2017

    As a result, the installation of waterfalls
    for decorating and aerating Koi ponds has increased.
    Generally E-coli take shelter in the digestive system of
    human beings, mostly in the intestines. Fortunately, nowadays
    you do not need to be like an emperor to adopt an indoor wall
    mounted waterfall.

  28. #29 by Micro chaine hifi classement at January 27th, 2017

    Good day I am so excited I found your website, I really found you by mistake,
    while I was browsing on Digg for something else,
    Regardless I am here now and would just like to say thanks a lot for a remarkable post and a all round interesting blog (I also love the theme/design), I
    don’t have time to go through it all at the moment but I
    have saved it and also added your RSS feeds, so when I have time I will be
    back to read more, Please do keep up the awesome b.

  29. #30 by sapphire gemstone online store at February 13th, 2017

    If are you currently utilizing a desktop (pc, notebook, Apple computer) Become a part of the product to laptop computer, notebook,
    Macintosh by means of Usb 2 0 cable tv and select
    the product as well as in the consumer title area, place
    the brand of the product, after you hookup the unit, start the video-game causing this
    sport prepared to accept study the info, then click on the Join” selection.

  30. #31 by mini proiettore at February 22nd, 2017

    Hurrah, that’s what I was looking for, what a data!
    present here at this webpage, thanks admin of this site.

  31. #32 by smart tv externo at February 28th, 2017

    My partner and I stumbled over here different page and thought I might
    check things out. I like what I see so now i’m following you.
    Look forward to exploring your web page for a
    second time.

  32. #33 by pickuplinesforgirls85.blox.pl at March 18th, 2017

    Take it this way, you and your sweetheart were extremely in love
    with each other back then.

  33. #34 by ccleaner download at May 10th, 2017

    I am very happy to discover your post, This is an excellent post. It is really what I wanted to see, hope in future you will continue for sharing such a excellent post

  34. #35 by Yeezy Boost 350 V2 Men at May 15th, 2017

    I’m still learning from you, as I’m trying to reach my goals.
    I certainly liked reading all that is written on your blog.Keep the information coming.
    I loved it!

  35. #36 by Dez Bryant Women Jerseys at August 2nd, 2017

    You could definitely see your enthusiasm within the article you write.
    The world hopes for even more passionate writers such as you who aren’t afraid to mention how
    they believe. Always go after your heart.

  36. #37 by Finance 60 inch tv at November 1st, 2018

    Most of all, ensure that a policy that you have bought will be enough
    for your death because occasionally, thhe insurance coverage benefit that beneficiaries receive are insufficient for the recovery from the loss and the expenses laid upon by it.
    Today’s world doesn’t need all types of business to
    begin withh its first day in operations out of a 10-story office with leather
    couches plus a glitzy waiting room. If you
    feel that you’d rather utilize the money you might have saved for Christmas
    on obtaining the family together and enjoying your time and energy together, you
    will find new solutions to pay for the expensive presents that youu simply buy.

  37. #38 by world news breaking at November 2nd, 2018

    Upcoming New Releases: Going with a similar concept above, if you have a friend in rasdio oor are only
    really ahead with tthe curve musically, you could prpduce a site
    that lists and describes thhe upcoming new album releases.

    However, each time a blogger does enjoy whyat he writes about, he’ll probably stay with it for some time time.
    Would your projects open up a brand new perspective or would it not
    just invoke a ‘what’s new’ response.

  38. #39 by Casino inside short at November 12th, 2018

    Excellent goods from you, man. I’ve understand your stuff previous to and you’re just extremely great.
    I really like what you’ve acquired here, certainly like what you’re stating and the way in which you say
    it. You make it enjoyable and you still take care of to
    keep it smart. I can not wait to read much more from you.
    This is really a terrific web site.

  39. #40 by http://futbalstavka.ga at November 13th, 2018

    Awesome! Its genuinely remarkable piece of writing, I
    have got much clear idea on the topic of from this article.

  40. #41 by InstaBuilder 2.0 Pricing at November 23rd, 2018

    Fine way of telling, and pleasant piece of writing to get
    facts on the topic of my presentation subject matter, which i am going to convey
    in college.

  41. #42 by led panel light dimmable at November 25th, 2018

    Having read this I thought it was really informative.
    I appreciate you taking the time and effort to put this informative article together.
    I once again find myself spending way tooo mucch time
    both reading and posting comments. But so what, it was still
    worthwhile!

  42. #43 by Peak85 Shilajit at November 27th, 2018

    Appreciate it for this post, I am a big big fan of this web site would
    like to keep updated.

  43. #44 by https://edelete.org/2018/11/led-strip-lights-are-Truly-Functional-in-every-perspective at November 29th, 2018

    Hi, all the time i used to check webpage posts here
    in the early hours in the break of day, since i
    enjoy to learn more and more.

  44. #45 by rules of survival wallhack 6.0 at December 1st, 2018

    You could certainly see your enthusiasm in the article you write.
    The sector hopes for more passionate writers like you who are not afraid to mention how they believe.
    At all times follow your heart.

  45. #46 by Education quotes famous at December 1st, 2018

    I the efforts you have put in this, appreciate it for all the great articles.

  46. #47 by hack rules of survival pc 7 3 at December 3rd, 2018

    After I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and now every time
    a comment is added I get four emails with the exact same comment.
    There has to be an easy method you can remove
    me from that service? Thanks a lot!

  47. #48 by 2 x 4 light fixtures at December 4th, 2018

    Nice weblog right here! Also your site rather a lot up very fast!
    What host are yyou the usage of? Can I get your associate hyperlink in your
    host? I desire my web site loaded up as quickly ass yourrs lol

  48. #49 by Keto One review website at December 4th, 2018

    Have you ever thought about publishing an e-book or guest authoring on other blogs?
    I have a blog centered on the same subjects you discuss and would really like to have you
    share some stories/information. I know my viewers would appreciate your work.

    If you’re even remotely interested, feel free to shoot me an e mail.

  49. #50 by Registration purpose at December 24th, 2018

    It’s awesome to visit this website and reading the views of all mates concerning this paragraph, while I am
    also zealous of getting familiarity.

(will not be published)