Please post in the Javascript API forum, and follow their posting guidelines (provide a link, don't paste code).
- pamela On Sat, Jun 13, 2009 at 3:56 AM, jlandwehr<[email protected]> wrote: > > > I am trying to get streetview into a div element in Firefox and am > having problems. The script seems to work OK inside using IE 7. With > firefox it sizes the initial map w/StreetView overlay incorrectly > (small with border on right and bottom.), and the "click" function > does not fire a new pano window like it does in IE 7. I've attached > the code. Any help appreciated. > > Jim Javanovice. > > <% > // avoid caching of this page > response.setDateHeader("Expires",0); > response.setHeader("Pragma", "no-cache"); > if (request.getProtocol().equals("HTTP/1.1")) { > response.setHeader("Cache-Control","no-cache"); > } > > // Get location parameters > String xArg = request.getParameter("x"); > String yArg = request.getParameter("y"); > > String key = request.getParameter("key"); > > // Set as default viewer > session.setAttribute("gcxExternalMapVisualizationDefaultViewer", > request.getRequestURL().toString()); > > %> > <html> > <head> > <title>Google Maps Viewer</title> > <meta http-equiv="content-type" content="text/html; charset=utf-8"/ >> > <link href="../css/gcxExternalMap.css" rel="stylesheet" type="text/ > css"> > <!-- Include GoogleMaps API --> > <script type="text/javascript"> > > var key1 = '<' + 'script src="http://maps.google.com/maps?' > + 'file=api&v=3&key=ABQIAAAAy3wawAYA7Cg2- > F3GGgvCGhTImgsh8XUXNHOaYYpgH4ADQD2CyBTcdkwKY2qRgPPiPia2JNbnAF3YIA" > type="text/javascript">' > + '<' +'/script>'; > > var key2 = '<' + 'script src="http://maps.google.com/maps?' > + 'file=api&v=3&key=ABQIAAAAy3wawAYA7Cg2- > F3GGgvCGhQSHHZOKn7XaOfw_LX-HahHxiXaFRTVkn8HI7Sy_hvRIysL0grpc4hRcg" > type="text/javascript">' > + '<' +'/script>'; > > var key3 = '<' + 'script src="http://maps.google.com/maps?' > + 'file=api&v=3&key=ABQIAAAAy3wawAYA7Cg2- > F3GGgvCGhSAZr2quCEJLrdfwLoRBiKME54zEhSpyVHDAID2sYjpSHQUmlrAR-3G6Q" > type="text/javascript">' > + '<' +'/script>'; > > if (window.location.host == 'devmaps.waukeshacounty.gov') { > document.write(key1); > } > else if (window.location.host == 'devgis-int.waukeshacounty.gov') > { > document.write(key2); > } > else if (window.location.host == 'devgis.waukeshacounty.gov') { > document.write(key3); > } > </script> > > > <script type="text/javascript"> > > var map = null; > var x=<%= xArg %>; > var y=<%= yArg %>; > var width; > var height; > var xPosition = 70; > var yPosition = 0; > > function incrementPosition() { > var xIncrement = 0; > var yIncrement = 17; > xPosition = xPosition + xIncrement; > yPosition = yPosition + yIncrement; > } > > window.onresize = resizeMap; > function resizeMap() { > container = document.getElementById("map"); > container.style.width = document.body.clientWidth + "px"; > container.style.height = document.body.clientHeight + "px"; > if (map) { > map.checkResize(); > } > } > > function yahooMapsControl() { > } > yahooMapsControl.prototype = new GControl(); > yahooMapsControl.prototype.initialize = function(map) { > var yahooMaps = document.createElement("div"); > yahooMaps.className = "GoogleMaps"; > yahooMaps.title= "View in Yahoo Maps"; > yahooMaps.noWrap = true; > yahooMaps.innerHTML = "Yahoo Maps"; > GEvent.addDomListener(yahooMaps, "click", function() { > url="waugcxYahooMaps.jsp?x="+x+"&y="+y; > document.location=url; > }); > map.getContainer().appendChild(yahooMaps); > return yahooMaps; > } > yahooMapsControl.prototype.getDefaultPosition = function() { > incrementPosition(); > return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize > (xPosition, yPosition)); > } > > function imfControl() { > } > imfControl.prototype = new GControl(); > imfControl.prototype.initialize = function(map) { > // Add IMF control > var imf = document.createElement("div"); > imf.className = "GoogleMaps"; > imf.title = "Zoom to location in IMF"; > imf.noWrap = true; > imf.innerHTML = "Focus IMF"; > GEvent.addDomListener(imf, "click", function() { > zf=457.2 > var dMap = parent.frames['mapFrame']; > if (dMap == null) { > if (self.opener) { > dMap = self.opener.parent.frames['mapFrame']; > } > } > if (dMap == null) { > alert("Your IMF applicaion is no longer available."); > } else { > dMap.zoomToLonLat(x,y,zf); > } > }); > map.getContainer().appendChild(imf); > return imf; > } > imfControl.prototype.getDefaultPosition = function() { > return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize > (xPosition, yPosition)); > } > > function load() { > if (GBrowserIsCompatible()) { > map = new GMap2(document.getElementById("map")); > map.setCenter(new GLatLng(y, x), 17); > map.setMapType(G_HYBRID_MAP); > map.addMapType(G_PHYSICAL_MAP); > map.addMapType(G_SATELLITE_3D_MAP); > svOverlay = new GStreetviewOverlay(); > map.addOverlay(svOverlay); > map.addControl(new GHierarchicalMapTypeControl()); > map.addControl(new GMapTypeControl()); > map.addControl(new GScaleControl()); > map.addControl(new GOverviewMapControl()); > map.addControl(new GLargeMapControl()); > map.addControl(new imfControl()); > map.addControl(new yahooMapsControl()); > > // Add moveEnd function to recalculate center position > GEvent.addListener(map, "moveend", function() { > var center = map.getCenter(); > x=center.lng(); > y=center.lat(); > }); > // Add Panoramic function to recalculate lat/long position > var myPano = new GStreetviewPanorama(document.getElementById > ("pano")); > GEvent.addListener(myPano, "error", handleNoFlash); > GEvent.addListener(map,"click", function(overlay,Glatlng) { > myPano.setLocationAndPOV(Glatlng); > var map = new GMap3(document.getElementById("map_canvas")); > }); > resizeMap(); > function handleNoFlash(errorCode) { > if (errorCode == FLASH_UNAVAILABLE) { > alert("Error: Flash doesn't appear to be supported by your > browser"); > return; > } > } > } > } > > </script> > </head> > <body onload="load()" onunload="GUnload()"> > <div id="map" style="width: 500px; height: 400px; position: > absolute; top:0px; left:0px"></div> > <div id="map_canvas" style="width: 500px; height: 300px"></div> > <div id="pano" style="width: 500px; height: 200px"></div> > </body> > </html> > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
