@chad hi.. well i'm working on my pc not internet.. but 'll do that next time..
@kashey Thank that was the problem.. can be closed :) On Mar 22, 8:20 am, kashey <[email protected]> wrote: > first> function initialize() { > > var map = new > > here you define LOCAL variable for function "initialize" > use "var window.map" or just remove "var" from here and define var map > somethere in the top of script > > and then toy create NEW MAP( again - NEW MAP ) in click event. > remove that lines where. > > On 22 ÍÁÒ, 02:02, Erwin Dicker <[email protected]> wrote: > > > well i'm doing something wrong.. > > > i traid to make this a global variable: var map = new > > google.maps.Map(document.getElementById("map_canvas"), > > > if i don't put that line in the > > google.maps.event.addDomListener(bermudaTriangle, 'click', function() > > { > > i get a error... > > > what happend when i click on the polygoon it make's a new map... > > what i wanna do is... click polygoon it goes away and you get the > > other polygoon... > > the final version is.. when you zoom in the redpolygoon goes away and > > you get the yello polygoon > > > <script type="text/javascript"> > > š š var myLatLng = new google.maps.LatLng(24.886436490787712, > > -70.2685546875); > > š š var myOptions = { > > š š š zoom: 5, > > š š š center: myLatLng, > > š š š mapTypeId: google.maps.MapTypeId.ROADMAP > > š š }; > > > š š var map; > > š š var bermudaTriangle; > > > š š var bb2 = new google.maps.LatLng(22.886436490787712, > > -68.2685546875); > > > š š var triangleCoords = [ > > š š š š new google.maps.LatLng(25.774252, -80.190262), > > š š š š new google.maps.LatLng(18.466465, -66.118292), > > š š š š new google.maps.LatLng(32.321384, -64.75737), > > š š š š new google.maps.LatLng(25.774252, -80.190262) > > š š ]; > > > š š // Construct the polygon > > š š bermudaTriangle = new google.maps.Polygon({ > > š š š paths: triangleCoords, > > š š š strokeColor: "#FF0000", > > š š š strokeOpacity: 0.8, > > š š š strokeWeight: 2, > > š š š fillColor: "#FF0000", > > š š š fillOpacity: 0.35 > > š š }); > > > google.maps.event.addDomListener(bermudaTriangle, 'click', function() > > { > > > // if i don't do this i get a error :S i have to make a new map :s... > > some how it won't get the info out of var > > // > > š š var map = new > > google.maps.Map(document.getElementById("map_canvas"), > > š š š š myOptions); > > > š š var triangleCoords = [ > > š š š š new google.maps.LatLng(22.774252, -78.190262), > > š š š š new google.maps.LatLng(16.466465, -64.118292), > > š š š š new google.maps.LatLng(30.321384, -62.75737), > > š š š š new google.maps.LatLng(22.774252, -78.190262) > > š š ]; > > > š š // Construct the polygon > > š š bermudaTriangle = new google.maps.Polygon({ > > š š š paths: triangleCoords, > > š š š strokeColor: "#FFFF00", > > š š š strokeOpacity: 0.8, > > š š š strokeWeight: 2, > > š š š fillColor: "#FFFF00", > > š š š fillOpacity: 0.35 > > š š }); > > > //here i get the error when i don't put google.maps.map in it > > š šbermudaTriangle.setMap(map); > > š map.setCenter(bb2) > > > }); > > > š function initialize() { > > > š š var map = new > > google.maps.Map(document.getElementById("map_canvas"), > > š š š š myOptions); > > > š šbermudaTriangle.setMap(map); > > š } > > > </script> -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
