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 rak gondola at May 25th, 2019

    Excellent weblog right here! Additionally your site quite
    a bit up fast! What web host are you the usage of?
    Can I get your associate link for your host? I
    want my site loaded up as quickly as yours lol

  2. #2 by teramune at May 25th, 2019

    My family always say that I am wasting my time here at
    web, except I know I am getting knowledge all the time by reading thes good articles or reviews.

  3. #3 by escort bayan Kadikoy at May 27th, 2019

    It is not my first time too visit this web site, i am browsing this site dailly and take nice information from here aall the time.

  4. #4 by a at May 27th, 2019

    Thanks for finally talking about >How embed
    Google Maps in Flex? < RIAfreaks <Loved it!

  5. #5 by AcıBadem Escort at May 28th, 2019

    What’s up colleagues, howw is everything, and wha you wish for
    to say on the topic of this article, in my view its in fact
    remarkable designed for me.

  6. #6 by thiết bị chống trộm hải nam at May 28th, 2019

    Please let me know if you’re looking for a author
    for your site. You have some really great posts 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 articles for your blog in exchange for a link back to mine.
    Please send me an e-mail if interested. Thank you!

  7. #7 by my website at May 29th, 2019

    I am truly grateful to the holder of this web page who has shared this fantastic post at here.

  8. #8 by yourbankcard.Com/apply today at May 29th, 2019

    This is the right blog for anybody who wants to understand
    this topic. You know so much its almost tough to argue with you (not
    that I actually will need to…HaHa). You definitely put a new spin on a topic which
    has been discussed for a long time. Wonderful
    stuff, just wonderful!

  9. #9 by hcgshots.net at May 30th, 2019

    Genuinely when someone doesn’t understand afterward its up to other people that they will assist, so here it happens.

  10. #11 by staciamcintyre.hatenablog.com at May 30th, 2019

    Heya i am for thee primary time here. I found this board aand I find It truly helpful & it
    helpd me out a lot. I am hoping tto offer something agaijn and help
    otherts such as you helped me.

  11. #12 by Landscaping AThens GA at May 30th, 2019

    Youu really make it seem so easy with your presentation but I find this topic to be actually something which I think I
    would never understand. It seems too complex annd very
    broad for me. I’m looking forward for your next post, I will tryy
    to get the hang of it!

  12. #13 by multi blade rip saw at May 31st, 2019

    I’ve read several just right stuff here. Definitely price bookmarking for revisiting.
    I wonder how so much effort you put to create
    this type of excellent informative website.

  13. #14 by android gclub at June 1st, 2019

    Hello excellent website! Does running a blog like this take a great deal of
    work? I have virtually no expertise in coding but I had been hoping to start my own blog soon. Anyhow, if you have any ideas or tips for
    new blog owners please share. I know this is off subject but I
    just wanted to ask. Thank you!

  14. #15 by a at June 1st, 2019

    Hi, yes this piece of writing is genuinely pleasant and I have learned lot of things from it about blogging.
    thanks.

  15. #16 by rear view camera in rearview mirror at June 1st, 2019

    What’s up, this weekend is pleasant for me, since this time i am reading this wondedrful educational post
    here at my residence.

  16. #17 by school at June 1st, 2019

    I’m very pleased to find this web site. I need to to
    thank you for your time due to this wonderful read!! I definitely enjoyed every part of it and I have you saved
    to fav to check out new stuff in your site.

  17. #18 by a at June 1st, 2019

    Magnificent web site. A lot of helpful information here.
    I am sending it to a few buddies ans also sharing in delicious.
    And of course, thank you for your sweat!

  18. #19 by blackberry curve at June 2nd, 2019

    I used to be recommended this blog by means of my cousin. I am not sure whether or not this post is
    written by means of him as no one else recognise such targeted approximately
    my difficulty. You’re incredible! Thanks!

  19. #20 by freeonEs at June 3rd, 2019

    Thanks for a marvelous posting! I definitely enjoyed reading it, you will be a great author.I will be sure to bookmark your blog and will eventually come back from now on. I want to encourage you to
    definitely continue your great writing, have a nice holiday weekend!

  20. #21 by easy loans nz at June 3rd, 2019

    Please let me know if you’re looking for a article author for your blog.
    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 absolutely love to write some material for
    your blog in exchange for a link back to mine. Please shoot me an e-mail if interested.

    Kudos!

  21. #22 by HempStreet CBD at June 3rd, 2019

    Great website you have here but I was curious about if you knew of any
    community forums that cover the same topics discussed here?
    I’d really love to be a part of community where
    I can get feedback from other experienced people that share the
    same interest. If you have any suggestions, please let me know.
    Appreciate it!

  22. #23 by yahoofinancequotes.com at June 3rd, 2019

    LeoKrie plenti

  23. #24 by a at June 4th, 2019

    I think that everything posted was actually very logical.
    However, what about this? suppose you wrote a catchier post title?
    I ain’t suggesting your content isn’t solid, but what
    if you added something that grabbed a person’s attention? I mean How embed Google Maps in Flex?
    « RIAfreaks is a little plain. You should peek at Yahoo’s home page and see how
    they create post headlines to get viewers to click. You might try adding a video or a related picture or two to get people excited about everything’ve
    got to say. In my opinion, it might bring your posts a little bit more interesting.

  24. #25 by big booty porn stars at June 6th, 2019

    Do you like big booty bitches? If yes you should definitely check BigBootyClips.com. You have never seen such a monster selection of bigbooty porn in your entire life. Take a look on your own :)

  25. #26 by Information Nigeria at June 6th, 2019

    In Segun Awonusi & E. A. Babalola (eds).

  26. #27 by www at June 6th, 2019

    For most up-to-date information you have to go to see world wide web and on web I found this web site as
    a most excellent website for newest updates.

  27. #28 by help me with my computer at June 6th, 2019

    I love forgathering useful information, this post has got me even more info!

  28. #29 by houston computer services at June 6th, 2019

    There is obviously a lot to realize about this. I believe you made some good points
    in features also.

  29. #30 by search at June 6th, 2019

    Every weekend i used to pay a visit this web site, as i want enjoyment,
    for the reason that this this website conations actually
    nice funny data too.

  30. #31 by Watch Free JAV HD at June 6th, 2019

    What’s up Dear, are you genuinely visiting this web page daily,
    if so afterward you will definitely obtain good experience.

  31. #32 by fa.wikipedia.org at June 7th, 2019

    What a data of un-ambiguity and preserveness of valuable know-how on the topic of
    unpredicted emotions.

  32. #33 by Xe Ford ranger giá tốt nhất thị trường at June 7th, 2019

    I don’t even know how I ended up right here, however I believed this publish was great.
    I don’t understand who you are however certainly you’re going to
    a famous blogger should you are not already. Cheers!

  33. #34 by blog at June 9th, 2019

    Excellent blog post. I certainly appreciate this website.
    Continue the good work!

  34. #35 by http://bigdogg9e.net/info.php?a=a+hrefhttpwww.feedbooks.comuser5283360profiledildo+reviewa at June 9th, 2019

    AMERICAN: Dildo” is still Tony’s favorite epithet.

  35. #36 by eastpoint rotary mechanic at June 11th, 2019

    cartrawler Car Hire Dublin Airport
    cartrawler Car Hire Dublin Airport. When you are planning a tour, you will
    always need to find the best options to explore a destination. Carhire121 will always be your companion when you are
    looking for most affordable car hire options. There are various international
    and local car hire firms that you can choose from. We compare prices from different car
    hire firms to find the best deal for your budget needs.

    Dublin

    Dublin is a wonderful place to visit. It has interesting history, world famous nightlife, and fantastic shopping.

    If you are willing to visit this wonderful Irish capital then don’t forget to compare prices and hire a cheap car at Dublin Airport.

  36. #37 by seo培训学习 at June 11th, 2019

    seo培训学习www.seo299.comseo培训学习www.seo299.com-客服咨询QQ996934-Email:996934@qq.com seo营销www.seo299.com

  37. #38 by Ponciano Melo at June 13th, 2019

    It is in point of fact a great and helpful piece of info.
    I am satisfied that you simply shared this helpful information with us.

    Please stay us informed like this. Thank you for sharing.

  38. #39 by Katrin at June 13th, 2019

    of course like your website however you have to check the spelling on quite a
    few of your posts. A number of them are rife with spelling issues and I find it very troublesome to tell the reality
    on the other hand I will definitely come again again.

  39. #40 by jasa bola at June 14th, 2019

    Hi there to all, as I am in fact eager of reading this
    web site’s post to be updated regularly. It includes pleasant stuff.

  40. #41 by Website Domain at June 16th, 2019

    It’s an amazing post in favor of all the online users; they will take advantage from it I am sure.

  41. #42 by parrot toys at June 17th, 2019

    That is a really good tip particularly to those fresh to the blogosphere.
    Simple but very precise information? Thanks for sharing this one.
    A must read article!

  42. #43 by 인터넷현금 at June 18th, 2019

    Simply wish to say your article is as astonishing.
    The clearness in your post is simply excellent and i could assume you are an expert
    on this subject. Fine with your permission allow me to grab your feed to keep updated with
    forthcoming post. Thanks a million and please carry on the gratifying work.

  43. #44 by 인스타그램팔로워늘리기 at June 18th, 2019

    naturally like your web site however you have to take a look
    at the spelling on several of your posts. A number of them are rife with spelling problems and
    I to find it very bothersome to tell the reality nevertheless I will definitely come back again.

  44. #45 by Click at June 18th, 2019

    How do I get a Job at Mc donalds they need 2 references? I wasn’t born yesterday I’ve regarded teachers they hate me.
    Ive regarded tutors they hate. Regarded church leaders they
    dont know me. Regarded as neighbors as with my ID but
    don’t really understand them. I’ve regarded family but mother and father is not gonna
    cut it nor do i have their… show more family are not acceptible.
    Sounds like you don’t

  45. #46 by Candy at June 19th, 2019

    Aw, this was an exceptionally nice post. Taking the time and actual effort to make a great article… but what
    can I say… I put things off a lot and don’t manage to get anything
    done.

  46. #47 by www.howtogrowyourpenis2014.com, https at June 19th, 2019

    It’s pеrfect time to make some plans for the future and it is tіme to be happy.
    I’ve read this post and іf I could I wiѕh to suggest
    you few interesting things or tips. Рerhaps you can wгite next articles
    referring to this article. I desire to read even more things abߋut
    it!

  47. #48 by boutique a éviter at June 20th, 2019

    Thanks , I’ve recently been looking for info approximately this subject for a while and yours is the greatest I’ve
    found out so far. But, what about the conclusion? Are you certain concerning the source?

  48. #49 by rama-akunting.co.id at June 20th, 2019

    Admiring the persistence you put into your website and detailed information you present.
    It’s great to come across a blog every once
    in a while that isn’t the same out of date rehashed information. Fantastic read!
    I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

  49. #50 by خرید آنلاین بلیط هواپیما at June 21st, 2019

    گردشگران و مسافرانی که به سفر
    تفریحی و مسافرت خود اهمیت ویژه ای
    قائل هستند تور اروپا نوروز 98 می تواند گزینه مناسبی به شمار آید.

(will not be published)