http://active.tutsplus.com/tutorials/xml/make-the-most-of-google-maps-new-features-for-flash/
On 27 March 2010 09:54, www.landed.at <[email protected]> wrote: > what are you using to get a 3d map ? > > On Mar 26, 3:11 pm, Cwynne <[email protected]> wrote: >> I currently have a 3d map embededd in flash however i want the user to >> be able to input start and end points >> for directions. Im not too sure how to implement this ive had a look >> at the direct load method but couldnt get >> it working. If anyone could point me in the right direction i would be >> most grateful. >> >> Below is my AS3 code >> >> Many thanks. >> >> import com.google.maps.LatLng; >> import com.google.maps.Map; >> import com.google.maps.Map3D; >> import com.google.maps.MapEvent; >> import com.google.maps.MapType; >> import com.google.maps.View; >> import com.google.maps.geom.Attitude; >> import com.google.maps.controls.NavigationControl; >> import com.google.maps.controls.MapTypeControl; >> import com.google.maps.controls.OverviewMapControl; >> import com.google.maps.overlays.*; >> import com.google.maps.InfoWindowOptions; >> import com.google.maps.MapMouseEvent; >> >> // Variables >> var map:Map3D; >> >> // No focus line >> stage.stageFocusRect = false; >> >> // Call the function to create the map >> add_map(); >> >> // Function that adds the map on stage >> function add_map() >> { >> map = new Map3D(); >> map.key = >> 'ABQIAAAA3vtjYHdEO3NC2rqkZwC33xRzKqgcxj2qkITL_qSDU0v9fL5pPxRPn0wLOU- >> V2n3QyKuRUM3icUleNw'; >> map.setSize(new Point(stage.stageWidth, stage.stageHeight)); >> map.addEventListener(MapEvent.MAP_READY, onMapReady); >> this.addChild(map); >> >> } >> >> // Function that will fire once map is created >> function onMapReady(event:MapEvent):void >> { >> map.setCenter(new LatLng(50.899197766773284, 4.486040573103489), 13); >> map.viewMode = View.VIEWMODE_PERSPECTIVE; >> map.setAttitude(new Attitude(20,40,0)); >> map.addControl(new MapTypeControl()); >> map.addControl(new OverviewMapControl()); >> map.addControl(new NavigationControl()); >> >> // Load the xml >> load_xml(); >> >> } >> >> // Add Markers On The Map >> function createMarker(latlng:LatLng, number:Number, tip, myTitle, >> myContent):Marker >> { >> // create Custom marker object >> var markerPin:marker_mc = new marker_mc(); >> // If your marker is to big you can scale it down here >> markerPin.width = 20; >> markerPin.height = 20; >> >> var i:Marker = new Marker( >> latlng, >> new MarkerOptions({ >> >> hasShadow: true, >> >> icon: this.addChild(markerPin), >> tooltip: >> ""+tip >> }) >> ); >> i.addEventListener(MapMouseEvent.CLICK, >> function(event:MapMouseEvent):void >> { >> map.openInfoWindow(event.latLng, new InfoWindowOptions({ >> >> titleHTML: ""+myTitle, >> >> contentHTML: ""+myContent >> })); >> >> }); >> return i; >> >> } >> >> // Function that will load the xml >> function loadXML(e:Event):void >> { >> XML.ignoreWhitespace = true; >> var map_xml:XML = new XML(e.target.data); >> for (var i:Number = 0; i < map_xml.location.length(); i++) >> { >> var latlng:LatLng = new LatLng(map_xml.location[i].lat, >> map_xml.location[i].lon); >> var tip = map_xml.location[i].name_tip; >> var myTitle:String = map_xml.location[i].title_tip; >> var myContent:String = map_xml.location[i].content_tip; >> >> map.addOverlay(createMarker(latlng, i, tip, myTitle, >> myContent)); >> } >> >> } >> >> function load_xml() >> { >> var xmlLoader:URLLoader = new URLLoader(); >> xmlLoader.addEventListener(Event.COMPLETE, loadXML); >> xmlLoader.load(new URLRequest("locations.xml")); >> >> } > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps API For Flash" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-maps-api-for-flash?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Maps API For Flash" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api-for-flash?hl=en.
