Mootools and VE mouse events in FireFox

Hello Everyone

Has anyone had any experience getting VE to work with mootools? I have found if the mootools script is in the same page as a VE map then in FireFox the VE mouse events do not work correctly.

The event fires fine, but the event arguements are not right. As an example see the code below which adds a simple pushpin and then attaches an onclick event to the map. The onclick event should be able to get the elementID from the event arguements however in firefox this is not present.

Code Snippet

<html>

<head>

<title></title>

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

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

<script>

var map =null;

var pinPoint =null;

var pinPixel =null;

function GetMap()

{

map =new VEMap('myMap');

map.LoadMap(new VELatLong(34.118875035799, -118.3003306388855), 14 );

map.AttachEvent("onclick",ShapeClickHandler);

AddNumberedPushpin();

}

function ShapeClickHandler(e){

//check if click was even over a shape (rather than just the map)

if (e.elementID !=null){

//check what type of shape was handled

var shape = map.GetShapeByID(e.elementID);

alert('shape clicked');

returntrue;

}

else{

alert('map clicked');

}

//else default to normal behavoir

returnfalse;

}

function AddNumberedPushpin(number,pinTitle,pinInfo){

var icon ="<div class=\"numberedpushpin\">" + number +"</div>";

var infobox ="<div class=\"custompopup\">" + pinInfo +"</div>"

AddPushpin(icon,pinTitle,pinInfo);

}

function AddPushpin(layer,pinIcon,pinTitle,pinInfo)

{

var shape =new VEShape(VEShapeType.Pushpin, map.GetCenter());

//Set the icon

if(pinIcon!=null) shape.SetCustomIcon(pinIcon);

//Set the info box

shape.SetTitle(pinTitle);

shape.SetDescription(pinInfo);

//Add the shape the the map

map.AddShape(shape);

}

</script>

</head>

<bodyonload="GetMap();">

<divid='myMap'style="position:relative; width:400px; height:400px;"></div>

</body>

</html>

I've tried looking through mootools and trying to debug what is happening, as well as changing the ordering of the script tags to change which file loads first.

Anyone any expereince or ideas?

Thanks

Brian Norman

www.earthware.co.uk

[7682 byte] By [Earthware] at [2008-1-7]

Windows Live Developer Forums

Site Classified