Select to view content in your preferred language

Clear Graphics when InfoWindow is closed

2156
3
10-28-2010 08:00 AM
by Anonymous User
Not applicable
Original User: Lynn_Carlson

Any chance someone can help a newbie with the code which would, upon clicking the close button on an InfoWindow, clear the graphics layer?

When I click the map, a red dot is created over the feature layer point and an info window opens with attributes from the feature layer.  When the info window is closed however, the red dot doesn't go away until the next feature is clicked.

I would prefer that the red dot goes away as soon as the info window is closed.

I have this so far:

protected function infoWindowClose(event:InfoWindow):void
{
redDotGraphicsLayer.clear();
}

but I have no idea how to call this function because the InfoWindow doesn't seem to have a way to identify itself.  It doesn't seem to have any properties such as id="......".

BTW - I am not using the Flex Viewer, rather I am creating custom code in Flash Builder, so I have no widgets to edit.

Flash Builder 4, ArcGIS 10, ArcGIS Server 10, Flex API 2.1

Thanks
0 Kudos
3 Replies
by Anonymous User
Not applicable
Original User: kenbuja

The way I did that in my project (although it's using FB3, using Flex API 1.3) is to add an event listener to the infowindow

myMap.infoWindow.addEventListener(Event.CLOSE, infoWindowClose);
myMap.infoWindow.show(myMap.toMap(point));

function infoWindowClose(closeEvent:Event):void
{
    redDotGraphicsLayer.clear();
}
0 Kudos
LynnCarlson__GISP
Regular Contributor
Got It!  Thanks so much!  I appreciate it!
0 Kudos
by Anonymous User
Not applicable
Original User: tanya.bisen

I m facing a similar situation but its just that moment I open an Infowindow all the graphics is getting cleared..Can anyone help me on this


Regards,
Tanay Bisen
0 Kudos