Rossko,
  Thanks a lot for your response. I just start to learn Google Map Api. Do
you mean I just need the following code in listener?

  Thanks a lot.

google.maps.event.addListener(map, 'idle', function() {
   number++;
   if (number%2==0)  //decide which kml file shoulded be used
       ctaLayer = new google.maps.KmlLayer(file1);
   else
       ctaLayer = new google.maps.KmlLayer(file2);
   ctaLayer.set('preserveViewport', true);
   ctaLayer.setMap(map);
  });

On Wed, Mar 23, 2011 at 1:44 PM, Rossko <ros...@culzean.clara.co.uk> wrote:

> >   google.maps.event.addListener(map, 'idle', function() {
> >     number++;
>
> This listener attaches to your original map
>
> >     var map = new
> > google.maps.Map(document.getElementById("map_canvas"), myOptions);
> >     ctaLayer.setMap(map);
>
> This destroys your original map, and makes a new one (with no
> listener)
>
> Why don't you have two KmlLayer objects, one map, and just switch
> between them with setMap?
>
> --
> 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
> google-maps-js-api-v3@googlegroups.com.
> To unsubscribe from this group, send email to
> google-maps-js-api-v3+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
>

-- 
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 google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to