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 a at December 24th, 2018

    I am really thankful to the holder of this web site who
    has shared this great article at at this place.

  2. #2 by pozycjonowanie at December 26th, 2018

    Good response in return of this query with firm arguments and telling everything concerning
    that.

  3. #3 by los angeles at December 27th, 2018

    Nice respond in return of this query with genuine arguments and describing everything
    on the topic of that.

  4. #4 by vitamin anak at December 31st, 2018

    The thing is though, it can be crucial to acquire sufficient levels
    of these 3 vitamins along with the ratio of A to D plays an important role.
    Although soluble by water, vitamin B12 also happens to be the vitamin with complicated
    molecular structure. The investment is at your continued good health and for enhancing health.

  5. #5 by E3 2012 at December 31st, 2018

    Thanks for sharing your thoughts on Ian Hogarth. Regards

  6. #6 by iphone 7 plus case at December 31st, 2018

    iphone 7 case 27872
    iphone 7 plus case
    Apple iPhone 6 Plus – Printed Flamingo Multi-Card Wallet with
    Matching Detachable Slim Case and Wristlet, Pink/White Apple
    iPhone 8 – Palm Leaves Printed Wallet with Matching Detachable Slim Case and Wristlet, Navy Blue/Green Apple iPhone 7 Plus
    - 4000mAh Slim Portable Battery Charger/Power Bank, Gold

  7. #7 by Http://mxo.hardlinedreams.com/forum/member.php?action=profile&uid=455093 at December 31st, 2018

    Hi to all, the contents present at this website are truly amazing for people experience, well, keep up the nice work fellows.

  8. #8 by Ecu Decoding training at January 2nd, 2019

    Simply wish too say your article iis as surprising. The clearness in your post iss simply spectacular
    and i could assume you’re an expert on this subject.
    Well with your permission allow me to grab your feed to keep updated with forthcoming post.
    Thanks a million and please continue the rewarding work.

  9. #9 by a at January 3rd, 2019

    Please let me know if you’re looking for a article author for your blog.
    You have some really good articles and I feel I would be a good asset.
    If you ever want to take some of the load off, I’d love to
    write some content for your blog in exchange for a link back to mine.
    Please blast me an e-mail if interested. Many thanks!

  10. #10 by https://madupenyuburkandungana.wordpress.com/ at January 7th, 2019

    The bees that this Ovimbundu hive are Cyprian in type, similar to the Italian bees employed in America
    as to size, but with shorter tongues and shorter tempers.
    It also protects your skin layer from your damage caused by the
    UV rays in the sun – the greatest element in age spot formation. Another wonderful thing about this element of modeling
    is the fact that often there is gonna be some work to be had.

  11. #11 by collapsible water bottle running at January 8th, 2019

    I read this post fully concerning the resembblance of hottest and preceding technologies, it’s amazing article.

  12. #12 by Divorce in georgia at January 9th, 2019

    I hardly leave a response, but i did some searching and
    wound up here How embed Google Maps in Flex? « RIAfreaks.

    And I do have some questions for you if you don’t mind.
    Could it be only me or does it look like some of these responses appear as if
    they are written by brain dead folks? :-P And, if you are posting at other
    social sites, I’d like to keep up with everything fresh you have to post.
    Could you list of every one of your community sites like your
    linkedin profile, Facebook page or twitter feed?

  13. #13 by furnituremoving at January 9th, 2019

    And I do have some questions for you if you don’t mind.
    Could it be only me or does it look like some of these responses appear as if
    they are written by brain dead folks? And, if you are posting at other
    social sites, I’d like to keep up with everything fresh you have to post.
    Could you list of every one of your community sites like your
    linkedin profile, Facebook page or twitter feed?

  14. #14 by Swiss Army Knife at January 11th, 2019

    Мost of our employees own several Swiss Army Knives.

  15. #15 by https://docs.google.com at January 12th, 2019

    Please let me know if you’re looking for a article author for your site.
    You have some really great articles and I think I would be a good asset.
    If you ever want to take some of the load off, I’d really like to
    write some articles for your blog in exchange for a link back
    to mine. Please blast me an e-mail if interested. Thanks!

  16. #16 by https://drive.Google.Com/file/d/1eAKDAodFRgARX-lr4MDJbMez9L3UnPfC/view?usp=sharing at January 15th, 2019

    Hi, its fastidious paragraph concerning media print, we all be familiar with media is a great source of data.

  17. #17 by Private Search Chrome Mac at January 22nd, 2019

    Thanks for any other wonderful article. The place else may anyone get that kind of
    information in such a perfect manner of writing?

    I have a presentation subsequent week, and I’m at the look for such information.

  18. #18 by https://automobilefragrancediffusernetwork95.webgarden.at/ at January 23rd, 2019

    Howdy, i read your blog from tikme to time and i oown a similar one
    and i was just wondering if you get a lot of spam feedback?
    If so howw do you stopp it, any plugin or anything
    you can suggest? I get so much lately it’s driving
    me crazy so any support is very much appreciated.

  19. #19 by bedding sets teenage girl at January 23rd, 2019

    I every time spent my half an hour to read his weblog’s articles all the time along with a cup off coffee.

  20. #20 by a at January 25th, 2019

    I am actually thankful to the holder of this
    site who has shared this enormous paragraph at at this place.

  21. #21 by homecleaningkw at January 26th, 2019

    We do not have at the cleaning company in Kuwait any complacency at the time, committed to the time specified by the customer and provide fast and guaranteed service of high quality and high, no matter how hard the spots,

  22. #22 by best display ads sizes at January 29th, 2019

    I have been exploring for a little for any high quality articles or weblog posts in this sort of space .
    Exploring in Yahoo I at last stumbled upon this site. Studying this info So
    i’m satisfied to exhibit that I’ve an incredibly just right uncanny feeling I discovered exactly what I needed.

    I so much undoubtedly will make certain to don?t forget this website
    and provides it a glance on a relentless basis.

  23. #23 by Home warranty coverage at January 29th, 2019

    Real wonderful visual alpeal on this internet
    site , I’d value it 10 10.

  24. #24 by Www.Meme.bambillio.com at January 31st, 2019

    Valuable information. Lucky me I found your website accidentally, and I am stunned why this twist of fate
    did not came about earlier! I bookmarked it.

  25. #25 by Best website at February 1st, 2019

    Aw, this was a really good post. Taking the time
    and actual effort to generate a superb article… but what can I
    say… I put things off a lot and don’t seem to get anything done.

  26. #26 by How do you make clear slime like in the movies? at February 5th, 2019

    Great blog right here! Also your site rather a lot up
    fast! What web host are you using? Can I get your affiliate
    link to your host? I desire my web site loaded up
    as quickly as yours lol

  27. #27 by Lake Norman Nc Wallpaper Installers In St Petersburg at February 8th, 2019

    Very shortly this web site will be famous amid all blogging visitors, due to it’s good content

  28. #28 by a at February 10th, 2019

    Every weekend i used to visit this site, for the reason that i wish
    for enjoyment, since this this website conations really nice funny information too.

  29. #29 by proxy for scraping at February 10th, 2019

    Hi there, You’ve done a fantastic job. I’ll certainly digg it and personally recommend to my friends.
    I am confident they will be benefited from this site.

  30. #30 by Computer Games at February 13th, 2019

    It’s nearly impossible to find experienced people for this subject, but
    you seem like you know what you’re talking about!
    Thanks

  31. #31 by Dwain at February 14th, 2019

    How to get screenshots in macbook air? how do i get screen shots using MacBook Atmosphere Command Shift 3 for a full screen Order Shift 4 for a selected
    region Command Change 4 Space Bar for a highlighted area

  32. #32 by Online Games For Teens At School at February 15th, 2019

    Having read this I believed it was very enlightening.
    I appreciate you spending some time and energy to
    put this content together. I once again find myself personally spending
    a lot of time both reading and commenting. But so what, it was
    still worth it!

  33. #33 by harga hp terbaru at February 15th, 2019

    Nothing wrong achievable, until you had bought a travel insurance policy which
    was supposed to safeguard you all the way in which to Tahiti.
    As an apprentice you will be supposed to invest some time learning how
    each role works, such as the pilots but also the ground crew.
    Body surfing is an activity that will require someone to keep afloat without using floating device in the turbulent water

  34. #34 by hosting free ssl at February 20th, 2019

    The reason behind this, the usage of this script was minimised to local users coupled with controlled functionality.
    As far ass features and reliabolity are concerned, Just – Host keeps up
    o their promises. You see, you may still find numerous important things you
    have to know about it system just like the following:1.

  35. #35 by a at February 22nd, 2019

    I am genuinely delighted to glance at this website posts which carries tons of useful data, thanks for providing these kinds of
    statistics.

  36. #36 by Ciara at February 24th, 2019

    Yоu too can have green tea оr rasрberry leaf tea.

  37. #38 by Minerva at February 26th, 2019

    Rаspgerгy Clafouti Recipe + Bigցer Picture.

  38. #39 by فلوراید تراپی at February 26th, 2019

    You’ll be better served bby a dedicated GPS working watcdh or a
    GPS watch that features exercise-monitoring features.

  39. #40 by Lorenzo at March 6th, 2019

    I do not know whether it’s just me or if perhaps everybody else experiencing issues with your blog.
    It appears like some of the text in your posts are running off the screen. Can somebody else please provide feedback and
    let me know if this is happening to them as well?
    This might be a problem with my internet browser because I’ve had this happen previously.
    Appreciate it

  40. #41 by garitamxl.com at March 11th, 2019

    hallo! Ich maag so so viel! Aktie Wir haten Kontakt mehr über Ihre Post auf AOL?

    I erforderlich Spezialist über dise Haus zu lösen mein Problem.
    Kann sein das ist Sie! Einn Blidk vor gleichewn Sie.

  41. #42 by Keto Flex at March 11th, 2019

    Good write-up, I am normal visitor of one’s site, maintain up the excellent operate, and It is going to be
    a regular visitor for a long time.

  42. #43 by Http://dqystl.com/ at March 13th, 2019

    Ich bin sicher, diese artice berührt hat all das Internet
    Zuschauer, es isst wirkich sshr schön anspruchsvollen Stück zu schreiben auf den Aufbau neuer Blog.

  43. #44 by Penny at March 13th, 2019

    It’s awesome to visit this web site and reading the views of all mates about this post, while I am also eager of getting experience.

  44. #45 by a at March 16th, 2019

    I am regular reader, how are you everybody?
    This piece of writing posted at this web site is in fact good.

  45. #46 by Willa at March 18th, 2019

    I am regular visitor, how are you everybody? This post posted at this
    website is genuinely nice.

  46. #47 by Best Deals Online at March 22nd, 2019

    Hi there every one, here every person is sharing these knowledge, therefore it’s pleasant to read this webpage, and
    I used to pay a quick visit this website everyday.

  47. #48 by vaniiPodolyak@mail.ua at March 28th, 2019

    An outstanding share! I’ve just forwarded this onto a coworker who had
    been doing a little homework on this. And he in fact ordered me lunch
    because I stumbled upon it for him… lol. So let me reword this….
    Thanks for the meal!! But yeah, thanks for spending some time
    to discuss this subject here on your website.

  48. #49 by Marko at March 28th, 2019

    This article is actually a nice one it helps new the web people, who are
    wishing in favor of blogging.

  49. #50 by dwinda at March 29th, 2019

    And he in fact ordered me lunch
    because I stumbled upon it for him… lol. So let me reword this….
    Thanks for the meal!! But yeah, thanks for spending some time
    to discuss this subject here on your website.
    https://liriklagubatak-terbaru.blogspot.com/2019/03/lirik-lagu-bcl-memilih-dia.html

(will not be published)