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 maxbet world leading sportsbook at July 26th, 2019

    Hi to every body, it’s my first pay a visit of this website; this web site contains remarkable and genuinely fine stuff for visitors.

  2. #2 by Scarlett at July 27th, 2019

    I don’t even know how I ended up here, but I assumed this put up was once great.
    I do not recognize who you’re however certainly you are going to
    a well-known blogger in the event you aren’t already.
    Cheers!

  3. #3 by www.Pizzamargarita.Com at July 27th, 2019

    This piece of writing will assist the internet viewers for setting up new blog or
    even a weblog from start to end.

  4. #4 by anastasia date fuck at July 28th, 2019

    I am truly happy to glance at this weblog posts
    which contains lots of valuable data, thanks for providing these information.

  5. #5 by top electric razor at July 30th, 2019

    Ergonomic and very functional, the shaver ensures
    comfort when shaving. The head moves freely and detects contours features.

    We all know someone with outstanding features. This bike is a compact electric motocross bicycle
    that features a electric motor that is potent.
    This Chinese Li-ion shower shaver not only looks blade that is dual, a 2,800 rpm motor and good , floating head also ensures that you obtain a shave.

    A mechanism where two blades work together accompanies this technique, the first one lifts the hair and the second cuts it,
    pieces it. Titanium steel blades: the 3500 has high quality ceramic steel
    blades that stop trims hair efficiently and skin irritation.
    These comfort rings include 1000s of powder-like beads which make the shaving heads easy –
    so since the shaver glides over your skin – it picks up
    flat-lying hairs without aggravation your skin & short.
    The sort of shave you’ll get from that razor is eloquent and
    good enough considering.

  6. #6 by Вы можете проверить здесь at July 30th, 2019

    Thhe problem with listing every variation of an word brings
    about the major search engines believing that you happen to be
    spam and deleting your URL. Thaat is just not to declare they seize your funds and do
    not present the product. I will likely be your mentor and coach online absolutely free as I trust helping as
    much people as I can.

  7. #7 by website at July 31st, 2019

    hello!,I really like your writing so a lot! share we be in contact extra approximately your article on AOL?
    I need an expert on this house to resolve my problem. Maybe that’s you!
    Looking ahead to see you.

  8. #8 by Нажмите, чтобы узнать больше at July 31st, 2019

    The internet marketing New York information mill a huge hit
    on the list of local entrepreneurs. Would it not make more sense to present you witfh
    that information free of charge so that thy could get you interested by their
    product. If your working in a number of provinces and territories it
    could become extremely expensive to subscribe and gaze after those registrations so you should know
    ahead of time whether it is absolutely necessary.

  9. #9 by agen judi online terpercaya at July 31st, 2019

    If you would like to get much from this paragraph then you have to apply these
    techniques to your won web site.

  10. #10 by 에어컨청소 at August 3rd, 2019

    What’s up Dear, are you in fact visiting this web page regularly, if so
    afterward you will absolutely obtain pleasant experience.

  11. #11 by link at August 4th, 2019

    You’re so awesome! I don’t believe I’ve read through a single
    thing like this before. So wonderful to find another person with a few
    unique thoughts on this issue. Seriously.. thanks for
    starting this up. This website is something that is
    required on the internet, someone with some originality!

  12. #12 by Yesenia Seitzinger at August 4th, 2019

    I personally not like cheap manufacturer earlier because of bad quality products. I generally trust bigger brands like Sony Samsung. But after purchasing xiaomi phone my whole perception for xiaomi changed. Till now I haven’t faced any serious problem in I would like to show my appreciation to this writer just for bailing me out of this predicament. Because of scouting throughout the internet and meeting concepts which are not productive, I assumed my life was over. Living devoid of the strategies to the issues you’ve solved by way of your entire short post is a critical case, as well as those which could have in a wrong way affected my career if I hadn’t encountered your blog post. Your primary training and kindness in touching every item was helpful. I’m not sure what I would’ve done if I hadn’t come across such a solution like this. I’m able to at this point look ahead to my future. Thanks so much for your reliable and result oriented help. I will not hesitate to endorse your web page to anybody who will need care on this area.

  13. #13 by исследовать этот сайт at August 5th, 2019

    Although it turned out received well everywhere in the world its Indian story
    ‘s what got a sensation from Suzuki’s perspective. So,
    careful consideration of the variety of factors is essential to find the
    best headstone. Althougfh you’ll unlikely deal with some gardening
    problems like pest infestation, you will
    still need to ensure to come up with the best hydroponic nutrient solution.

  14. #14 by Garbage Roll Off Containers Russell at August 5th, 2019

    But a target of recycling of up to 50% of home waste is achievable and environmentally justified
    to cease current high levels of garbage pollution.

  15. #15 by Lyman Rettkowski at August 5th, 2019

    GreatExcellentGood blogweb sitesite you haveyou’ve gotyou have got here.. It’s hard to finddifficult to find qualityhigh qualitygood qualityhigh-qualityexcellent writing like yours these daysnowadays. I reallyI trulyI seriouslyI honestly appreciate people like youindividuals like you! Take care!!

  16. #16 by cutting tool distributors at August 6th, 2019

    Hi all, here every one is sharkng these know-how, thus it’s pleasant to
    read this weblog, and I used tto visit this web site
    every day.

  17. #17 by qandora for pi at August 7th, 2019

    It’s not my first timne to go tto see this web site, i am visiting this ste
    dailly and obtain good inforrmation from here daily.

  18. #18 by get more info at August 7th, 2019

    This website has a good article and alot of content.thanks alot god blessed.

  19. #19 by خرید بلیط هواپیما at August 7th, 2019

    Omalo to Shatili
    این دست خط دارای یکی از بی نظیرترین
    صنع های گرجستان می بادا که معماری های قرون وسطایی آن پرسنل
    معماری های بی نظیر به حساب می آید.

  20. #20 by Bitcoinaussiesystem.org at August 7th, 2019

    I visited various web sites but the audio quality for audio songs edisting at thuis web site is in fact fabulous.

  21. #21 by Nike Sale Store at August 8th, 2019

    Hello there, I found your web sitge by tthe use of Google whilst looking for a elated subject, your website got here
    up, it seems to be good. I have bookmarked it in my google bookmarks.

    Hello there, simply changed into alert to youur blog via Google, and locaed that it is truly informative.
    I’m going to be careful for brussels. I will be grateful for those who continue this
    iin future. Lots of folks will probably be benefited from
    your writing. Cheers!

  22. #22 by www.loseweightngainmuscle.com at August 8th, 2019

    Hello, I think your site might be having browser compatibility issues.
    When I look at your blog site in Ie, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that,
    excellent blog!

  23. #23 by Lost My Phone at August 8th, 2019

    Among the best out there may be Lookout ($25).

  24. #24 by Elise Ziesemer at August 10th, 2019

    RT @dinfomall: gift makeup hair nails man tools body bath skin fragrance
    brushes beauty ultabeauty makeup girl gift time today skin indiedev shopping gamedev maternity tips business headphones
    Today’s Beautyful Deal

  25. #25 by หวยไทยรัฐงวดนี้ at August 11th, 2019

    Thank you for any other wonderful post. The place else could anyone get that kind of information in such an ideal manner of writing?
    I have a presentation next week, and I am on the look for
    such info.

  26. #26 by chaterba at August 11th, 2019

    Besides, totally free chat is broadly available, so you are able to enjoy it even if you’re on a budget.
    It is possible to input any random chat room and revel in the ease of speaking with other people as if they have been in the same area with you.
    It is possible to easily start a dialog with those who share the exact hobbies and interests , so that you can decide whether they’re
    well worth meeting in real life or it would be only a waste of time.
    Most cam sites display precisely the very same versions which you’ll find on a lot of different affiliated sites, but we
    have truly distinctive and exclusive models that you wont find anywhere else.
    Coins may also be employed to tip the versions. Tip models or input shows.
    This website provides you the ability to rapidly
    find tons of hot models on the internet at any given instant.

    It’s a highly addictive cam girl site with a great deal of hot American girls
    on the internet at any given instant. Unlike many male cam
    chat sites, CamDudes presents you with astounding models which
    are really unique to our site. A mix of amateur and professional models.

    This is an ideal mix of professional and amateur versions allowing you to
    find precisely what you’re looking for.

  27. #27 by International Trade Select Committee at August 12th, 2019

    A fascinating discussion is definitely worth comment. There’s no
    doubt that that you should write more on this topic, it
    may not be a taboo matter but typically folks don’t
    speak about such issues. To the next! Cheers!!

  28. #28 by Chrish George at August 13th, 2019

    I have gone through your content, I found it quite interesting and informative. However, this is to let the readers know that My Assignment Services is offering online essay assignment help and other services for students who are enrolled in a programming language. We all are aware of the issues and challenges that a student encounter in writing programming assignment. Such students may be happy to hear that python assignment help is available in their region by a team of subject specialists. These writers are skilled, proficient and have years of experience in research essay assignment help, case study assignment help etc. My Assignment Services is firm offering web-based assistance in their academic concerns whether it is writing assignment, homework, project etc. Availing help from our services can be the best choice for you if you any issues with your academic tasks.

  29. #29 by car workshop near me at August 13th, 2019

    What’s Going down i am new to this, I stumbled upon this
    I have found It positively helpful and it has aided me
    out loads. I’m hoping to give a contribution & aid
    different users like its helped me. Good job.

  30. #30 by Link Alternatif Terbaru at August 14th, 2019

    It’s going to be end of mine day, but before finish I am reading this wonderful post to improve my knowledge.

  31. #31 by 로우바둑이 at August 14th, 2019

    현금바둑이 so funny 신암행어사게임 http://www.mofg3.com

  32. #32 by Ashley Grybel at August 14th, 2019

    I have seen that charges for on-line degree professionals tend to be an awesome value. For example a full Bachelors Degree in Communication from The University of Phoenix Online consists of Sixty credits with $515/credit or $30,900. Also American Intercontinental University Online comes with a Bachelors of Business Administration with a whole school element of 180 units and a price of $30,560. Online degree learning has made obtaining your diploma been so detailed more than before because you may earn your own degree from the comfort of your abode and when you finish working. Thanks for all other tips I’ve learned through the web site.

  33. #33 by Seguro de auto en houston at August 17th, 2019

    Thanks a bunch for sharing this with all people you
    actually know what you’re talking about! Bookmarked. Kindly additionally talk over with my
    website =). We may have a link change contract among us

  34. #34 by refurbished iphone at August 18th, 2019

    Apple’s iPhone XR is on saoe at a lower than ever pricxe
    in refurbished condition (with warranty) – …

1 5 6 7
(will not be published)