It's worth noting that openInfoWindow returns an IInfoWindow which you
could keep rather than a Boolean. Eg:

public var myInfoWindow : IInfoWindow  = null;

myMarker.addEventListener(MapMouseEvent.CLICK, function
(e:MapMouseEvent):void {
                           this.myInfoWindow = e.target.openInfoWindow
(infoWindowOptions);
                        });
myMarker.addEventListener(MapEvent.INFOWINDOW_CLOSED, function
(e:MapEvent):void {
                           this.myInfoWindow = null;
                        });

will do the same as above, and when you're checking if the window is
open you can do:

public function isInfoWindowOpen() : Boolean {
    if (this.myInfoWindow && this.myInfoWindow.removed) {
         // The info window has been closed but for some reason we
weren't notified so cleanup
         this.myInfoWindow = null;
    }
    if (this.myInfoWindow) return true;
    return false;
}

This is better imho in that you're not relying on the
INFOWINDOW_CLOSED event firing and also as Google add functionality to
the IInfoWindow then you'll be ready to use it going forward. In my
experience there are enough corner cases where the user can do
something unexpected to justify being this paranoid :).

Cheers,
Chris

On Sep 1, 10:40 am, V <[email protected]> wrote:
> Hi!,
>
> With your Class:
>
> public var infoWindowOpen:Boolean = false;
>
> In main:
>
> myMarker.addEventListener(MapMouseEvent.CLICK, function
> (e:MapMouseEvent):void {
>                            e.target.openInfoWindow(infoWindowOptions);
>
>                         });
> myMarker.addEventListener(MapEvent.INFOWINDOW_CLOSED, function
> (e:MapEvent):void {
>                            e.target.infoWindowOpen = false;
>                         });
> myMarker.addEventListener(MapEvent.INFOWINDOW_OPENED, function
> (e:MapEvent):void {
>                         e.target.infoWindowOpen = true;
>                         });
>
> Thank's a lot!
>
> On Aug 24, 8:55 pm, helen <[email protected]> wrote:
>
>
>
> > There is no field in the Marker class to tell you this.
> > I can think of a couple options:
> > 1 - easiest to just call marker.closeInfoWindow() without checking; if
> > it isn't open, nothing will happen
> > 2 - You can extend the Marker class to have a boolean field called
> > something like 'infoWindowOpen' and set a listener for
> > INFOWINDOW_CLOSED event when you handle the click event that opens the
> > info window, so you can set the value of your boolean appropriately.
> > For example (off the top of my head, not guaranteed to work as is):
>
> > public class MyMarker extends Marker {
> >   private var infoWindowOpen:Boolean = false;
> >   public function MyMarker(....) {
> >     super(....);
> >     this.addEventListener(MapMouseEvent.CLICK, onMarkerClick);
> >   }
> >   private function onMarkerClick(event:MapMouseEvent):void {
> >     this.openInfoWindow(new InfoWindowOptions({...}));
> >     this.addEventListener(MapEvent.INFOWINDOW_CLOSED, onInfoWinClose);
> >     this.infoWindowOpen = true;
> >   }
> >   private function onInfoWinClose(event:MapEvent):void {
> >     this.infoWindowOpen = false;
> >     this.removeEventListener(MapEvent.INFOWINDOW_CLOSED,
> > onInfoWinClose);
> >   }
> >   public function get openedInfoWindow():Boolean {
> >     return this.infoWindowOpen;
> >   }
>
> > }
>
> > Hope that helps.
>
> > On Aug 22, 11:48 am, V <[email protected]> wrote:
>
> > > Hi,
>
> > > I need to know if the infoWindow of a marker is open.
>
> > > Something like that....
>
> > > // this.arrayMarkers is and array of all markers on the map.
>
> > > for each ( var marker:Marker in this.arrayMarkers ) {
> > >         if ( marker.getLatLng().lat() == nnnnnnnnnn ) {                   
> > >                               if
> > > ( marker.infoWindow.open ) {
> > >                         marker.closeInfoWindow();
> > >                         break;
> > >                 }
> > >         }
>
> > > }
>
> > > Thanks a lot!
--~--~---------~--~----~------------~-------~--~----~
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