I work in Flash Builder 4 with the Google Map ActionScript API. I created a map, loaded some custom markers onto it, and added some MouseEvent listeners to each marker.
The problem occurs when I load the InfoWindow panel. I want to dynamically set htmlContent based on the information stored in the database. The problem is that this information can change every two seconds, and each marker has a unique data set, so I cannot statically set it during marker creation. I have a method that loads all the records from my database into the Object variable every minute. Everything that I need to display in htmlContent is contained in this object under a unique identifier.
The main problem is that for me there is no way to uniquely identify the information window, so I can not determine what information to display in the panel.
marker.addEventListener(MapMouseEvent.ROLL_OVER, function(e:MapMouseEvent):void { showInfoWindow(e.latLng) }, false, 0, false);
This is my mouse event listener. The function I call, "showInfowindow", looks like this:
private function showInfoWindow(latlng:LatLng):void { var options:InfoWindowOptions = new InfoWindowOptions({title: appData[*I NEED A UNIQUE ID HERE!!!*].type + " Summary", contentHTML: appData[*I NEED A UNIQUE ID HERE!!!*].info}); this.map.openInfoWindow(latlng, options); }
I thought that I could do something by passing a variable in the declaration of the event listener, but she just hates passing a dynamic variable, it returns only the last value.
Example:
marker.addEventListener(MapMouseEvent.ROLL_OVER, function(e:MapMouseEvent):void { showInfoWindow(e.latLng, record.unit_id) }, false, 0, false);
This decision is painfully close to work. I repeat the loop to create my markers, when I try the above solution and flipped the marker, I get information, but each marker information reflects any information created by the last marker.
I apologize for the long explanation, but I just wanted to make my question as clear as possible. Does anyone have any ideas on how to fix my almost-something solution that I posted below or from the very beginning?
Thanks in advance,
Peter Hanneman