Thanks Pamela, Could you go in to a bit more detail, my skills with arrays are somewhat limited?
Thanks On Apr 20, 12:26 pm, pamela fox <[email protected]> wrote: > Hi Ranglo- > > The problem you're running into is that of function closure. The [i] > referenced in the event listener callback will always be the last > value of the i, not the value at which it was assigned. You should > wrap it in a function instead. There's an example > here:http://code.google.com/apis/maps/documentation/flash/events.html#Even... > > - pamela > > > > On Sun, Apr 19, 2009 at 6:53 PM, Ranglo <[email protected]> wrote: > > > I am currently trying to learn FLEX to improve my web GIS projects, > > however I have run into a problem. So far I have successfully managed > > to create polygon data from a SQL database, now I am trying to add > > infowindow functionality. I have followed the state map demo but am > > unsure how to populate the infowindow with the name field from my > > database. The function I have tried so far is below. Any help is much > > appreciated. > > > private var p:Polygon; > > > private function onResult(e:ResultEvent):void > > { > > var list:ArrayCollection = e.result.map.loc; > > var arrayObject:Array = new Array(); > > for(var i:int=0; i<list.length; i++) > > { > > arrayObject[i] = new LatLng(list[i].lat, > > list[i].lon); > > } > > p = new Polygon(arrayObject); > > p.addEventListener(MapMouseEvent.CLICK, > > function > > (e:MapMouseEvent):void > > { > > map.openInfoWindow(event.latLon, new > > InfoWindowOptions({content: > > list[i].name})); //This is the bit I suspect is completely wrong > > } > > }- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
