使用 Actionscript 代码删除了 Flex 4 上下文菜单
我有一些代码无法理解其行为,希望得到任何解释和修复:
使用此代码时,我设法删除了 Flex 4 上下文菜单,但删除警报时,上下文菜单返回到右键单击...奇怪的行为!!!
<script language="javascript">
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>
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="javascript">
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原因很简单:警报是模态的,会强制闪入后台并破坏调用堆栈。一旦发生这种情况,在您关闭警报框后,Flash 将无法重新获得控制权,因为您原来的右键单击鼠标事件现已过期。
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.