Aug 20, 2013, 7:41 AM
[CLOSED] event not seen in FireFox
Hi,
I'am adjusting the drawing example 'Australia' in such a way that the user can click in the map. Based on the coordinates some other (mapping) action are then executed.
I added a click-listener:
I tried adding lines like (suggestions found on internet):
var e= event || window.event;
or
var e = window.event ? event : e;
Only leaving event as a parameter makes FireFox popping up an alert, but than the click location is not returned.
Do you have any idea?
Hans Wapenaar
I'am adjusting the drawing example 'Australia' in such a way that the user can click in the map. Based on the coordinates some other (mapping) action are then executed.
I added a click-listener:
sprite.Listeners.MouseOver.Handler = string.Format("onMouseOver(this, {0}, {1});", JSON.Serialize(colors[i]), i);
sprite.Listeners.MouseOut.Handler = "onMouseOut(this);";
sprite.Listeners.Click.Handler = "onClick(this, event);";
In the javascript section I added: function onClick(sprite, e) {
var curX;
var curY;
if (e.pageX || e.pageY) {
curX = e.pageX;
curY = e.pageY;
} else if (e.clientX || e.clientY) {
curX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
curY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
alert('click: ' + curX + " " + curY);
}
This works in IE9/10 and Chrome. But in FireFox not reaction and result.I tried adding lines like (suggestions found on internet):
var e= event || window.event;
or
var e = window.event ? event : e;
Only leaving event as a parameter makes FireFox popping up an alert, but than the click location is not returned.
Do you have any idea?
Hans Wapenaar
Last edited by Daniil; Aug 22, 2013 at 9:01 AM.
Reason: [CLOSED]