{"id":211,"date":"2011-01-13T14:26:21","date_gmt":"2011-01-13T13:26:21","guid":{"rendered":"http:\/\/www.capri-soft.de\/blog\/?p=211"},"modified":"2011-02-02T13:39:46","modified_gmt":"2011-02-02T12:39:46","slug":"flex-3-und-google-maps-api","status":"publish","type":"post","link":"https:\/\/www.capri-soft.de\/blog\/?p=211","title":{"rendered":"Flex 3 und Google Maps API"},"content":{"rendered":"<h1>Aufgabenstellung<\/h1>\n<p>In eine Flex-Anwendung soll Google Maps integriert werden.<\/p>\n<h1>Ansatz<\/h1>\n<p>1.) Aufruf der Seite http:\/\/code.google.com\/intl\/de\/apis\/maps\/documentation\/flash\/<br \/>\n2.) Runterladen der Flash-Bibliothek (SWC-Datei) und einf\u00fcgen in das LIBS-Verzeichnis der Flex-Anwendung<br \/>\n3.) Anfordern des Schl\u00fcssels unter &#8222;Wie beginne ich&#8230;&#8220; und eintragen in den Code unten.<\/p>\n<h1>L\u00f6sung<\/h1>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n&lt;mx:Application xmlns:mx=&quot;http:\/\/www.adobe.com\/2006\/mxml&quot; layout=&quot;absolute&quot;&gt;\r\n&lt;mx:Script&gt;\r\n\t&lt;!&amp;#91;CDATA&amp;#91;\r\n\t\timport com.google.maps.overlays.Marker;\r\n\t\timport com.google.maps.controls.ZoomControl;\r\n\t\timport com.google.maps.geom.Attitude;\r\n\t\timport mx.controls.Alert;\r\n\t\timport com.google.maps.*;\r\n\t\timport com.google.maps.geom.*;\r\n\t\timport com.google.maps.services.GeocodingEvent;\r\n\t\timport com.google.maps.services.ClientGeocoder;\r\n\t\timport com.google.maps.controls.NavigationControl;\r\n\t\timport com.google.maps.controls.MapTypeControl;\r\n\t\timport com.google.maps.MapEvent;\r\n\t\t\r\n\t\tpublic function onMapReady(event:MapEvent):void\r\n\t\t{\r\n\t\t\t\/\/ Die Bedienelemente der Karte hinzuf\u00fcgen\r\n\t\t\tmap.addControl(new MapTypeControl());\r\n\t\t\tmap.addControl(new NavigationControl());\r\n\t\t\tthis.geocodeLocation(&#039;Fulda, Am Rinnweg 15&#039;);\r\n\t\t}\r\n\t\t\r\n\t\tpublic function onMapPreinitialize(event:MapEvent):void\r\n\t\t{\r\n\t\t\tvar myMapOptions:MapOptions = new MapOptions();\r\n\t\t\tmyMapOptions.viewMode = View.VIEWMODE_2D;\r\n\t\t\tmyMapOptions.mapType=MapType.NORMAL_MAP_TYPE;\r\n\t\t\t\/\/myMapOptions.zoom=0;\r\n\t\t\tmap.setInitOptions(myMapOptions);\r\n\t\t}\r\n\t\t\r\n\t\tprivate function geocodeLocation(location:String=&#039;&#039;):void\r\n\t\t{\r\n\t\t\tvar geocoder:ClientGeocoder = new ClientGeocoder();\r\n\t\t\tgeocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS,\r\n\t\t\tgeoCodeSuccess);\r\n\t\t\tgeocoder.addEventListener(GeocodingEvent.GEOCODING_FAILURE, \r\n\t\t\tgeoCodeFailure);\r\n\r\n\t\t\tif(location!=&#039;&#039;)\r\n\t\t\t{\r\n\t\t\t\tgeocoder.geocode(location);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tgeocoder.geocode(search.text);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tprivate function geoCodeSuccess(event:GeocodingEvent):void\r\n\t\t{\r\n\t\t\tvar placemarks:Array = event.response.placemarks;\r\n\t\t\tmap.flyTo(placemarks&amp;#91;0&amp;#93;.point, 18, new Attitude(35,60,35), \r\n\t\t\t3);\r\n\t\t\tvar marker:Marker = new Marker(placemarks&amp;#91;0&amp;#93;.point); \r\n\t\t\tmap.addOverlay(marker); \r\n\t\t}\r\n\t\t\r\n\t\tprivate function geoCodeFailure(event:GeocodingEvent):void\r\n\t\t{\r\n\t\t\tAlert.show(&#039;Also wissense, das find ich einfach ned....&#039;,\r\n                                       &#039;\u00c4hm...&#039;);\t\t\t\r\n\t\t}\t\t\r\n\t&amp;#93;&amp;#93;&gt;\r\n&lt;\/mx:Script&gt;\r\n\t&lt;mx:TitleWindow layout=&quot;vertical&quot; width=&quot;100%&quot; height=&quot;100%&quot; \r\n              title=&quot;Finde versteckte Sch\u00e4tze... \r\n             (c) die 1st-level-caches Schludi&amp;amp;Mephi &quot;&gt;\r\n\t\t&lt;maps:Map3D xmlns:maps=&quot;com.google.maps.*&quot; \r\n\t\t\t  id=&quot;map&quot; \r\n\t\t\t  mapevent_mapready=&quot;onMapReady(event)&quot; \r\n\t\t\t  mapevent_mappreinitialize=&quot;onMapPreinitialize(event)&quot;\r\n\t\t\t  width=&quot;100%&quot; \r\n\t\t\t  height=&quot;100%&quot;\r\n    \t\t  key=&quot;HIER KOMMT DER BEANTRAGTE GOOGLE KEY REIN&quot;\/&gt;\r\n    \t&lt;mx:HBox horizontalAlign=&quot;center&quot; width=&quot;100%&quot; height=&quot;30&quot;&gt;\r\n\t\t\t&lt;mx:Label x=&quot;70&quot; y=&quot;524&quot; text=&quot;Da will ich hin:&quot; \r\n                                        width=&quot;120&quot; fontWeight=&quot;bold&quot;\/&gt;\r\n\t\t\t&lt;mx:Button x=&quot;421&quot; y=&quot;520&quot; label=&quot;Suchen ...&quot; \r\n                                        click=&quot;{geocodeLocation()}&quot;\/&gt;\r\n\t\t\t&lt;mx:TextInput id=&quot;search&quot; x=&quot;167&quot; y=&quot;520&quot; \r\n                                       width=&quot;246&quot;\/&gt;\r\n    \t&lt;\/mx:HBox&gt;\r\n\t&lt;\/mx:TitleWindow&gt;\r\n&lt;\/mx:Application&gt;\r\n<\/pre>\n<h1>Beispiel<\/h1>\n<p>http:\/\/baugebiete.fulda.de<\/p>\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=https%3A%2F%2Fwww.capri-soft.de%2Fblog%2F%3Fp%3D211&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px;margin-top:5px;\"><\/iframe>","protected":false},"excerpt":{"rendered":"<p>Aufgabenstellung In eine Flex-Anwendung soll Google Maps integriert werden. Ansatz 1.) Aufruf der Seite http:\/\/code.google.com\/intl\/de\/apis\/maps\/documentation\/flash\/ 2.) Runterladen der Flash-Bibliothek (SWC-Datei) und einf\u00fcgen in das LIBS-Verzeichnis der Flex-Anwendung 3.) Anfordern des Schl\u00fcssels unter &#8222;Wie beginne ich&#8230;&#8220; und eintragen in den Code unten. L\u00f6sung &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;mx:Application xmlns:mx=&quot;http:\/\/www.adobe.com\/2006\/mxml&quot; layout=&quot;absolute&quot;&gt; &lt;mx:Script&gt; &lt;!&amp;#91;CDATA&amp;#91; import com.google.maps.overlays.Marker; import com.google.maps.controls.ZoomControl; import &hellip; <a href=\"https:\/\/www.capri-soft.de\/blog\/?p=211\" class=\"more-link\"><span class=\"screen-reader-text\">Flex 3 und Google Maps API<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[],"class_list":["post-211","post","type-post","status-publish","format-standard","hentry","category-adobe-flex"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4yGeN-3p","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=211"}],"version-history":[{"count":8,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions"}],"predecessor-version":[{"id":276,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions\/276"}],"wp:attachment":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}