Get your own customer support community
 

Map display does not always update on MapComponent set center

I have a list of lat/lon locations in a Flex DataGrid, with a click handler on the grid that calls MapComponent's set center method to re-center the map on the selected location. Sometimes this works, but often the display fails to update until you click the datagrid a second time. Alternatively, I found that simply mousing over another Flex control (like a button, checkbox, or silder) after making the datagrid selection will also trigger an update to center the map on the correct location.

I've tried it with the latest svn trunk version (AS3 r 767), and the zipfile swc (ModestMaps-AS3-1.0-r749), with the same result. I tested with an old swc from a prior project (1+ yr old), and the problem did not surface.

Below is a simple MXML example that demonstrates the issue... thanks for any help you can offer... this one is driving me nuts!

Jay W

<?xml version="1.0" encoding="utf-8"?>
<mx:application>

<modest:mapcomponent height="400" width="400">

<!-- displays a list of sample locations; click should center the map on that location -->
<mx:datagrid width="300">
<mx:columns>
<mx:datagridcolumn width="100">
</mx:datagridcolumn><mx:datagridcolumn>
</mx:datagridcolumn></mx:columns>
</mx:datagrid>

<mx:script>
<![CDATA[
import com.modestmaps.geo.Location;
import mx.collections.ArrayCollection;

//sample locations to plot (San Diego county)
private static const locations:ArrayCollection = new ArrayCollection([
{name:"San Diego", loc:"32.715685,-117.161724"},
{name:"La Jolla", loc:"32.83746,-117.271539"},
{name:"Del Mar", loc:"32.954892,-117.263482"},
{name:"Chula Vista", loc:"32.640565,-117.084154"},
{name:"El Cajon", loc:"32.79495,-116.959469"}
]);

[Bindable] private var centerLocation:Location = new Location(33,-117);

// centers the map on the point selected in data grid
private function setLocation():void
{
myMap.center = locationsDG.selectedItem.loc.toString();
myMap.zoom = 14;
}
]>
</mx:script>
</modest:mapcomponent></mx:application>
 
sad I’m confused
Inappropriate?
1 person has this problem

User_default_medium