onclick VE Collection

Hey! I have found out how to add a VE Collection pulled from local.live.com. I had a program in the past then when you clicked on a custom pushpin the address would show up in the text box, now I am trying to figure out how to do with a VE Collection. I have the code and it shows up but once you click it nothing happenes. It goes by ID so I dont know if you have to do something special it being the collection but the code it below so it you can help that would be great! Thanks

<html>

<head>

<title></title>

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

<script src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"></script>

<script>

var map = null;

var layerid=0;

var source="21354515151!541";

function GetMap()

{

map = new VEMap('mymap');

try {

map.LoadMap(new VELatLong(45.54575, -87.45745), 11 ,'r' ,false);

} catch(e) {

}

AddMyLayer();

}

function AddMyLayer(type)

{

var veLayerSpec = new VELayerSpecification();

veLayerSpec.Type = VELayerType.VECollection;

veLayerSpec.ID = layerid;

veLayerSpec.LayerSource = source;

veLayerSpec.Method = 'get';

map.AddLayer(veLayerSpec);

layerid++;

}

function onPinLoad(pin)

{

pin.style.zIndex = 102;

pin.parentNode.style.zIndex = 102;

}

VEPushpin.prototype.GetContent= function()

{

var pinId=this.ID+"_"+this.m_vemap.GUID;

var content="<img onload='onPinLoad(this)' class='"+this.IconStyle+"' src='"+this.Iconurl+"' id='"+pinId+"' ";

var isTitleValid=this.Title!=null&&this.Title!="undefined"&&this.Title.length>0;

var isDetailsValid=this.Details!=null&&this.Details!="undefined"&&this.Details.length>0;

if(isTitleValid||isDetailsValid)

{

content+=" onmouseout='VEPushpin.Hide();' onmousedown='VEPushpin.Hide(true);' onmouseover='VEPushpin.Show(\""

+this.m_vemap.GUID

+"\",\""

+this.ID

+"\","

+this.LatLong.Latitude

+","+this.LatLong.Longitude;

if(isTitleValid)content+=", \""+escape(this.Title)+"\"";

else content+=",\"\"";

if(isDetailsValid)content+=", \""+escape(this.Details)+"\"";

else content+=",\"\"";

content+=",\""+this.TitleStyle+"\"";

content+=",\""+this.DetailsStyle+"\"";

content+=");' ";

}

content += " onclick='PinClick(" + this.ID + ")'";

content+=" />";

return content;

}

function PinClick(id)

{

switch (id)

{

case 0:

document.getElementById('txtfinish').value = "address1";

break;

case 1:

document.getElementById('txtfinish').value = " address2";

break;

case 2:

document.getElementById('txtfinish').value = " address3";

break;

case 3:

document.getElementById('txtfinish').value = " address4";

break;

case 4:

document.getElementById('txtfinish').value = " address5";

break;

}

}

</script>

</HEAD>

<body onload="GetMap();">

<div id="myMap" style="WIDTH:705px; POSITION:relative; HEIGHT:505px"></div>

Start: <INPUT id="txtStart" type="text" name="txtStart"> Destination: <INPUT id="txtFinish" type="text" name="txtFinish" readonly>

<INPUT id="getdir" type="button" value="Get Directions" name="getdir" onclick="FindDir();">

<a href=window.print()"><FONT size="3">Print Directions</FONT></a>

<div id="drivingDirections" style="WIDTH:705px; POSITION:relative; HEIGHT:160px"></div>

</body>

</HTML>



Answer this question

onclick VE Collection

  • twaltz

    Hi,

    I have the same query. How do i construct a source. Were you able to successfully implement it

    Please let me know.

    Thanks and Regards,

    Madhu.

    Email: madhu.gandhi@patni.com



  • onclick VE Collection