NerdyNick


In IE6 and IE7 but not Firefox I continue to get the error "Unkown Runtime Error" Line 1690 or 1689. I have been able to some what narrow it down to a problem somewhere along creating and adding a polygon (VEShape) to the map. I am using the most resent VE SDK V5 if that helps.

I have tried to narrow it down further but IE is seeming not to follow my Try/Catchs.

Thanks



Re: "Unkown Runtime Error" Line 1690/1689

Derek Chan


Can you please post some sample code to duplicate the problem your having





Re: "Unkown Runtime Error" Line 1690/1689

NerdyNick

Code Snippet

var points = new Array();
points.push(SalesPlotter.LatLong(findArguments[0].LatLongRect.TopLeftLatLong.Latitude, findArguments[0].LatLongRect.TopLeftLatLong.Longitude, this.options.mapType));

points.push(SalesPlotter.LatLong(findArguments[0].LatLongRect.TopLeftLatLong.Latitude, findArguments[0].LatLongRect.BottomRightLatLong.Longitude, this.options.mapType));

points.push(SalesPlotter.LatLong(findArguments[0].LatLongRect.BottomRightLatLong.Latitude, findArguments[0].LatLongRect.BottomRightLatLong.Longitude, this.options.mapType));

points.push(SalesPlotter.LatLong(findArguments[0].LatLongRect.BottomRightLatLong.Latitude, findArguments[0].LatLongRect.TopLeftLatLong.Longitude, this.options.mapType));

var lineColor = SalesPlotter.Color(255, 255, 255, 1.0,this.options.mapType);
var fillColor = SalesPlotter.Color(100, 200, 200, 0.2,this.options.mapType);

var icon = '<div class="PolygonIcon"><a href="#" onclick="map.addZipCode('+ this.polygons.length +'); return false;">'+ zipcode + '</a></div>';
var polygon = this.interface.createPolygon(points, lineColor, fillColor, 2, zipcode, icon);

this.interface.addShape(polygon);

//This.Interface.addShape(polygon)
this.mapObj.AddShape(polygon);

This is everything that goes with the creation of the polygon. SalesPlotter.LatLong() is the same as calling VELatLong(). The same goes for SalesPlotter.Color() being VEColor();






Re: "Unkown Runtime Error" Line 1690/1689

NerdyNick

I have found the problem. It appears the VEShape.SetCustomIcon does not take <a> tags. This becomes a probelm for me becuase I need to have an OnClick event for the icon. Any ideas about how to preform this. I have tried an onClick event on the <div> tag but it seems to not be working.



Re: "Unkown Runtime Error" Line 1690/1689

SoulSolutions

try using the event handlers built into V5. Look at the iSDK:

http://dev.live.com/virtualearth/sdk/

section: Use events and callbacks -> Attaching shape events


Code Snippet

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx v=5"></script>
<script>
var map = null;

function ShapeHandler(e)
{
if (e.elementID != null)
document.getElementById('resultDiv').innerHTML = e.eventName + " event occurred on shape (id=" + e.elementID + ").";
else
document.getElementById('resultDiv').innerHTML = e.eventName + " event occurred on map.";
}

function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
map.SetZoomLevel(10);
AddPolygon();

map.AttachEvent("onmouseover",ShapeHandler);
map.AttachEvent("onmouseout",ShapeHandler);
}

function AddPolygon()
{
var ll = map.GetCenter();
var lat = ll.Latitude;
var lon = ll.Longitude;

var shape = new VEShape(VEShapeType.Polygon, [new VELatLong(lat,lon-0.15),
new VELatLong(lat+0.1,lon-0.05),
new VELatLong(lat+0.1,lon+0.05),
new VELatLong(lat,lon+0.15),
new VELatLong(lat-0.1,lon+0.05),
new VELatLong(lat-0.1,lon-0.05)]);
shape.SetTitle('My polygon');
shape.SetDescription('This is a shape.');
map.AddShape(shape);
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<div id='resultDiv' style="position:relative; width:400px;">Move the mouse over the polygon to see the event.</div>
</body>
</html>

John.