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 Dudley Sirrine at May 12th, 2013

    Google has decided that its users of their well-liked Google Maps service will begin becoming charged a fee for utilizing their service. Websites that are going embedding a Google Map of their location will be charged a fee for usage.This new Google Maps fee is going to hit mostly the bigger companies, particularly the Travel industry. I suspect that certain websites that are the heaviest users would be websites like TripAdvisor and Expedia.”;

    Take a look at the most up to date article on our new blog
    http://www.homeimprovementstuffs.com/

  2. #2 by www.missyouarshi.com at July 30th, 2013

    I am really inspired along with your writing skills as smartly
    as with the format on your weblog. Is this a paid
    topic or did you modify it your self? Either way keep up the nice high quality
    writing, it’s uncommon to peer a nice blog like this one these days..

  3. #3 by analytics at November 2nd, 2014

    Hello there, You’ve performed an excellent job. I’ll certainly digg it and for my part recommend to my friends. I am confident they’ll be benefited from this website.

  4. #4 by casino website, at January 6th, 2015

    Fantastic beat! I must apprentice whilst you change your website, just . Casino Website,how may possibly i sign up for the website site? The particular account forced me to be the tolerable bargain. I were little bit well known of your your transmit presented amazing obvious concept

  5. #5 by Polo Ralph Lauren Sale T-Shirts at June 11th, 2015

    Awesome George doll. We need one of those in our house!
    Polo Ralph Lauren Sale T-Shirts http://www.lalingscakes.com/news.php?pid=403

  6. #6 by Levný Nike SB Stefan Janoski Max at June 11th, 2015

    do you have an rss feed?
    Levný Nike SB Stefan Janoski Max http://www.fotolis.cz/photo/boty2511

  7. #7 by 超人気新品 3日間限定 at August 20th, 2015

    私は実際に私は本当に、このライトアップと上のスポット この驚くべきより多くのの注目サイトは} {多くを必要とします。私でしょう、より多くのためのおかげで| 再び戻っ 情報!
    超人気新品 3日間限定 http://www.mistos.es/hot-24930-205.html

  8. #8 by 3日間限定 二つ折り本物保証 at August 20th, 2015

    、事したがっていくつかのいずれかが彼の必要を検索し、彼/彼女が願い詳細にその利用できるようにするために、したがってそのことは、こちらに維持されています。
    3日間限定 二つ折り本物保証 http://muzmarx.ru/hot-24506-178.html

  9. #9 by おすすめ特集 2015春夏新色追加 at August 20th, 2015

    仲間、その偉大 段落 上 家庭教師と完全 説明は、すべての時間をそれを維持します。
    おすすめ特集 2015春夏新色追加 http://www.rolfho.com/hot-25419-207.html

  10. #10 by 店内全品ポイント10倍 カバン 中古 at August 20th, 2015

    こんにちはこんにちはあり、だけ なった |あなたのにアラートを認識して ブログ スルーグーグル、とが見つかりました それがあることを有益|それは本当にです。ブリュッセル| 注意して気をつけてください | つもりつもり | 私は私がよ。 私がします | 必要があります 続けるこのは感謝する感謝します将来。 多くの 他の人々 でなければならないあなたから恩恵を受けアウトあなた執筆。乾杯!
    店内全品ポイント10倍 カバン 中古 http://www.thedangerouskitchen.com/hot-24523-207.html

  11. #11 by 最大50%割引 2015春夏新色追加 at August 20th, 2015

    あなたが誰であるか、| ビジターリーダー私は、正規のですか?この記事これを掲示 Webページ 本当に いいです。
    最大50%割引 2015春夏新色追加 http://surveyors.nl/?175=21322

  12. #12 by 2015春夏の新作が登場 店内全品ポイント10倍 at August 20th, 2015

    良い 仕事と生産配信発生 維持し続けてください!
    2015春夏の新作が登場 店内全品ポイント10倍 http://ecolifestl.com/hot-25229-208.html

  13. #13 by 安心の全品国内発送 セール対象商品 at August 25th, 2015

    実際には非常に興味深い、これがある|非常に熟練したブロガーあなたがしているあなたにしています。 私が持っている と素晴らしいのより求めることを楽しみにしてあなたに参加したポストを。また、私がしている私のソーシャルネットワークで Webサイトサイトあなたを共有しました!
    安心の全品国内発送 セール対象商品 http://www.capitol-nutrition.net/gain-24855-213.html

  14. #14 by メール便送料無料 うれしい高額買取り at August 25th, 2015

    こんにちはあり。私はMSNを使用して、あなたのブログを見つけました。よく書かれた記事これは、です。 私はよ てくださいブックマークにそれをするとリターンをあなたの有用なの続きを読むに。ポストをありがとう。 カムバック | 確かに間違いなく | 私は意志私がよ。
    メール便送料無料 うれしい高額買取り http://www.zkhs.hr/tide-24707-211.html

  15. #15 by メール便送料無料 ピアス 新作 at August 25th, 2015

    あなたは本当にそれはあなたのプレゼンテーションとそう簡単に見えるように、私は、この問題を見つける| その私が思うに、私は理解できないだろうされるように本当に実際に何かを。 複雑な複雑と非常私のための広範なそれはあまりにもそうです。あなたの次のポストのために楽しみにして| 私は私は、私はよそれのこつを取得しよう!
    メール便送料無料 ピアス 新作 http://www.yug-business.ru/tide-24223-189.html

  16. #16 by Longchamp Bags Sale at September 2nd, 2015

    hey I your magnanimous, weblog
    Longchamp Bags Sale http://www.uprint.me.uk/me/IZTvszF/

  17. #17 by http://europa.eu at September 7th, 2015

    In supply of these financial products the lenders do not
    involve just about any credit checks; due to this the loan total is made open to you at a faster
    rate? Lastly, you should try and safe and sound many different types of backing for this business enterprise.

  18. #18 by Hulda at September 7th, 2015

    Absolutely composed content material, Really enjoyed looking through.

  19. #19 by www.lifelutheranchurch.org at September 8th, 2015

    Thank you for another fantastic article. The place else could anyone get that type of information in such a
    perfect manner of writing? I’ve a presentation subsequent week,
    and I am on the look for such information.

  20. #20 by http://www.middlegeorgiaorthopaedics.com at November 18th, 2015

    Having read this I thought it was very enlightening.I appreciate you spending
    some time and effort to put this short article together.
    I oncee again find myself spending way tooo much tie both reading and posting comments.
    But so what, it wass still worfh it! http://www.middlegeorgiaorthopaedics.com

  21. #21 by http://www.ksourceit.com at November 22nd, 2015

    Spot on with this write-up, I hlnestly tnink this website needs much
    more attention. I’ll probbly be back agaiin to read more,
    thanks for the info! http://www.ksourceit.com

  22. #22 by http://www.writetechnology.net at November 25th, 2015

    Thanks for any other informative website. Where els may just I get that type of info written in such a perfect way?
    I’ve a mission that I am just now operating on, and I’ve been at the glance out
    for such information. http://www.writetechnology.net

  23. #23 by http://www.ogdenridjanovic.com at November 28th, 2015

    After checking out a few of the blog articles on your blog, I honestly like your terchnique
    of writing a blog. I added it to mmy bookmark webpage list and will be checking back soon. Takke a look at my
    web site as well and tell me your opinion. http://www.ogdenridjanovic.com

  24. #24 by peacock bass fly fishing brazil at September 1st, 2016

    No query the warmwater fishing has been the focus of most around
    right here the previous 3 or 4 weeks.

  25. #25 by beauty and the beast 2017 movie at September 9th, 2016

    Getting onto its cult list is part of the joys, but once
    you’re locked in, you may get access to the newest and greatest
    brands.

  26. #26 by film streaming ita at September 12th, 2016

    Trash stars Martin sheen however the stars of the film are a trio of children who
    play children that uncover one thing that was not
    meant for them and puts them on the run from the
    cops and different unsavory characters.

  27. #27 by 中 3成績 下がる at September 13th, 2016

    中学3年にもなってまだ、する気が起きない人の口実。「勉学するのが億劫だから・・・」では、家庭教師が待ち構えていて、テーブルには学習道具が用意されている。そして、家庭教師が、今日やるべきテキストブックやワークブックを開き、この設題から解き明かすようにと指示をしてくれたとします。

  28. #28 by maracuja at September 14th, 2016

    Hurrah! In the end I got a web site from where I know how to
    really obtain useful information regarding my study and knowledge.

  29. #29 by Hiram at September 15th, 2016

    A back link from a popular or credible website will certainly
    cause the internet search engine to begin and see the new website to crawl
    and index its contents.

  30. #30 by Paul Ponna Biography at September 15th, 2016

    Paul Ponna is a talented man that loves to teach and I know I cannot wait to get a hold of this 1 and give you all my full Commission Autopilot Overview.

  31. #31 by https://penzu.com/ at September 15th, 2016

    Do not have sexual contact (vaginal, oral, or anal) from the time of your first genital
    symptoms till your signs are entirely gone.

  32. #32 by Lakeisha at September 17th, 2016

    Carbon fiber development, a digicam that can swing around in any route, and dual-operator management—one individual flies whereas
    another controls the digicam—set it aside from client models.

  33. #33 by Elissa at September 18th, 2016

    It is possible for the herpes simplex virus to lay inactive in the body for several years prior to the first signs
    appear.

  34. #34 by airtel digital tv recharge at September 18th, 2016

    I am not certain where you are getting your info,
    however good topic. I needs to spend a while learning much more or understanding more.
    Thank you for fantastic info I was searching for this information for
    my mission.

  35. #35 by www.pennsylvania-magazine.com at September 18th, 2016

    Herpes is an incurable viral infection that is identified by agonizing sores on the genitals.

  36. #36 by pokemon go tips at September 20th, 2016

    Pokémon Go is insanely popular, and iits servers appear to be struggling with demand att peak times.

  37. #37 by tiket bus online at September 25th, 2016

    Kat Gold Coast ni guna public transport je. Kalau nak naik bus atau tram touch
    je card tu, simple.

  38. #38 by best fishing kayak at September 25th, 2016

    Generally I don’t learn post on blogs, but I wish to say that this write-up very pressured me to
    try and do it! Your writing taste has been amazed me.

    Thank you, quite nice article.

  39. #39 by paul2online at October 4th, 2016

    I do accept as true with all the ideas you have introduced for your post.
    They are very convincing and will certainly work.
    Still, the posts are too brief for novices. May you please prolong them
    a little from next time? Thanks for the post.

  40. #40 by 老眼 ルテイン サプリ at October 10th, 2016

    目にはルテインが有効とはよく言われてますが、果たしてルテインの何が眼のどの部位に有効なのだと考えますか。最近瞳の疲労がひどく、目薬のみだと治療がゆっくりなのでルテインサプリを使用しようかと念頭に置いています。人類の眼には元々ルテインが含有されています。更にルテインには活性酸素を取り除く働きもあり、網膜剥離、白内障の眼病予防からも守ってくれます。

  41. #41 by clash royale gratuit at October 12th, 2016

    F*ckin’ awesome things here. I’m very happy to peer your article.
    Thank you a lot and i’m having a look forward to touch you.
    Will you please drop me a mail?

  42. #42 by kaigi at October 14th, 2016

    Simply desire to say your article is as surprising.
    The clearness on your publish is just excellent and that i could assume you’re a professional in this subject.
    Fine along with your permission let me to grab your feed to keep up
    to date with impending post. Thank you a million and please carry on the rewarding work.

  43. #43 by linear guide stepper motor at October 26th, 2016

    Alors si vous souhaitez entretenir votre corps
    et votre santé au quotidien, le stepper est l’appareil qu’il vous
    faut.

  44. #44 by cupom brasil at October 29th, 2016

    Great article.

  45. #45 by tactical certainly isnt at November 1st, 2016

    At present’sunits depend energy, measure slep patterns and monitor heart
    rates in addition to steps.

  46. #46 by juarapokers.com at November 4th, 2016

    Hiya very nice blog!! Man .. Beautiful .. Superb ..
    I will bookmark your website and take the feeds additionally…I’m satisfied to seek out numerous
    helpful information here in the publish, we want work
    out more techniques in this regard, thanks for sharing.

  47. #47 by http://www.plaquissimo.fr at November 6th, 2016

    J’ai joué plusieurs heures avec les différents paramètres de rendu au niveau de sans obtenir de meilleur résultat.

  48. #48 by Google at November 8th, 2016

    search engine marketing Spezialisten nutzten Google Analytics und andere Tools zur Optimierung – das steckt beim Marketplace noch ganz in den Kinderschuhen und es gibt kaum Amazon-Tools oder Zahlen durch das Seller Central.

  49. #49 by certificazioni alimentari at November 10th, 2016

    They should create and maintain the internal environment in which people
    can become fully involved in achieving the organization’s objectives.

  50. #50 by best video sharing plugin for wordpress at November 17th, 2016

    An person can also gain popularity if they create a video that is entertaining
    and exciting sufficient for people to share it around
    to their close friends and family members.

1 2 3 7
(will not be published)