Try

1. to move 'var marker' outside the function scope to class scope,
and
2. to move the event handler function in [[[marker.addEventListener
(MapMouseEvent.CLICK, function(e:Event):void]]] to a class function.

In both, they are scope problem, not really related to Maps API.

my 2 cents.

Juguang

On Jun 23, 1:11 am, Mili <[email protected]> wrote:
> Pamela or anybody else,
>
> Requets your help to understand why the inofwindow is not getting
> displayed at respective marker's place in below code. Urgent help
> would be much apprecitated.
>
> Please find the code below -
> ************************************************************
> <?xml version="1.0" encoding="utf-8"?>
>  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> layout="absolute">
>          <!--
>           Copyright 2008 Google Inc.
>           Licensed under the Apache License, Version 2.0:
>              http://www.apache.org/licenses/LICENSE-2.0
>          -->
>         <mx:Script>
>              <![CDATA[
>                 import com.google.maps.InfoWindowOptions;
>                 import com.google.maps.MapMouseEvent;
>                         import com.google.maps.overlays.MarkerOptions;
>                         import com.google.maps.overlays.Marker;
>                         import com.google.maps.LatLng;
>                         import com.google.maps.Map;
>                         import com.google.maps.MapEvent;
>                         import com.google.maps.MapType;
>                         import com.google.maps.LatLngBounds;
>                         import com.google.maps.controls.MapTypeControl;
>             import com.google.maps.controls.ZoomControl;
>
> private function onMapReady(event:Event):void {
>                 map.setCenter(new LatLng(40.736072,-73.992062), 15,
> MapType.NORMAL_MAP_TYPE);               map.addControl(new ZoomControl
> ());
>                 addMarkers();
>
> }
>
> private function addMarkers():void{
>         var mapBounds:LatLngBounds = map.getLatLngBounds();
>         var sw:LatLng = mapBounds.getSouthWest();
>         var ne:LatLng = mapBounds.getNorthEast();
>         var latLen:Number = ne.lat() - sw.lat();
>         var lonLen:Number = ne.lng() - sw.lng();
>         for (var i:int = 0; i < 7; i++)
>         {
>         var tmp:LatLng = new LatLng(sw.lat() + latLen*Math.random(), sw.lng()
> + lonLen*Math.random() );               var marker:Marker = new Marker(tmp, 
> new
> MarkerOptions ({ draggable:true ,
> iconAlignment:MarkerOptions.ALIGN_VERTICAL_CENTER, hasShadow:false}));
>     // Adding Infowindow object to the current marker
>    marker.addEventListener(MapMouseEvent.CLICK, function(e:Event):void
> {
>            marker.openInfoWindow(
>               new InfoWindowOptions({content: "I am InfoWindow",
>                                                             height:
> 50,
>                                                            hasShadow:
> false,
>
> drawDefaultFrame: true,
>                                                         cornerRadius:
> 20,
>                                                       alpha:1
>                                                        })
>                                            );
>       });
>        map.addOverlay(marker);}//for loop
> }//addmarkers
>
>                 ]]>
>         </mx:Script>
>         <maps:Map xmlns:maps="com.google.maps.*"
>                 id="map"
>                 mapevent_mapready="onMapReady(event)"
>                 width="100%" height="100%"
>                 key="74JjRfRQFHJdktFHbvcEcI1hLVXhNrvK"
>                 />
>  </mx:Application>
>
> ********************************************************
>
> Thanks
> -Mili
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to