SetMapView causes the bird's eye icon to show an incorrect value

Hi,

When the map loads, calling SetMapView() causes the status of the bird's eye icon on the dashboard to be incorrect.

I am sure the reason is related to some asynchronous calculations that the Earth Map Control is performing when the map loads.

What I don't like is that the bird's eye icon on the dashboard is enabled, which is wrong when the map loads.

<html>

<head>

<title>Incorrect status of the Bird's Eye View icon when the map loads</title>

<metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/>

<scriptsrc='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5'></script>

<scripttype="text/javascript">

var map =null;

var latitude = 53.2290;

var longitude = -1.4392;

var locs =new Array();

locs.push(new VELatLong(latitude+2,longitude+2));

locs.push(new VELatLong(latitude-2,longitude-2));

var zoomLevel=10;

function GetMap()

{

map =new VEMap('myMap');

map.LoadMap(new VELatLong(latitude, longitude), zoomLevel ,'r' ,false,VEMapMode.Mode2D);

if (checkboxTimeout.checked)

{

//this works correctly

window.setTimeout("DelayedSetMapView()", 1000);

}

else

{

//this works incorrectly

map.SetMapView(locs);

}

}

function DelayedSetMapView()

{

map.SetMapView(locs);

}

function OnLoadPage()

{

GetMap();

}

function OnUnloadPage()

{

DisposeMap();

}

function DisposeMap()

{

locs.length=0;

if (map !=null)

{

map.Dispose();

map=null;

}

}

</script>

</head>

<bodyonload="OnLoadPage();"onunload="OnUnloadPage();">

<divstyle="z-index: 101; left: 24px; width: 480px; position: absolute; top: 472px;

height: 100px">

When the map loads, the bird's eye view icon on the dashboard is enabled.&nbsp;<br/>

This is wrong, there is no bird's eye view at this zoom level.<br/>

The icon should&nbsp; be disabled when the map loads.</div>

<divid='myMap'style="position:relative; width:488px; height:400px; left: 8px; top: 16px; z-index: 100;">

</div>

<inputid="checkboxTimeout"style="z-index: 102; left: 32px; position: absolute;

top: 440px"type="checkbox"/>

<divstyle="z-index: 103; left: 56px; width: 448px; position: absolute; top: 440px;

height: 16px">

Call SetMapView() with timeout when the map loads</div>

</body>

</html>

[6823 byte] By [AlexandruMatei] at [2008-1-4]

Windows Live Developer Forums

Site Classified