i have some code that i couldn't understand its behavior, will appreciate any explanation and fix :
when using this code i managed to remove flex 4 context menu, but when removing the alerts the context menu returns to right click... strange behavior !!!!
<script language="javas开发者_如何转开发cript">
function click(e) {
if (navigator.appName == 'Netscape' && e.which == 3) {
//alert("no right click please")
return false;
}
else {
if (navigator.appName == 'Microsoft Internet Explorer' && event.button == 2) {
//alert("no right click please")
return false;
}
}
return true;
}
document.onmousedown = click
</script>
The reason is quite simple: the alerts, being modal, forces flash into the background and breaks the callstack. Once this happen, flash cannot regain control after you dismiss the alertbox, because your original rigthclick mousevent has now expired.
精彩评论