我正在尝试创建一个布尔值,用于检查鼠标右键是否被按下。使用鼠标左键此方法有效,但使用鼠标右键布尔值保持为真,我该如何解决这个问题?
public var mDown:Boolean = false;
public var rmDown:Boolean = false;
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseHandler);
stage.addEventListener(MouseEvent.RIGHT_MOUSE_DOWN, mouseHandler);
stage.addEventListener(MouseEvent.RIGHT_MOUSE_UP, mouseHandler);
private function mouseHandler(e:MouseEvent){
switch(e.type){
case MouseEvent.MOUSE_DOWN: mDown = true;
break;
case MouseEvent.MOUSE_UP: mDown = false;
break;
case MouseEvent.RIGHT_MOUSE_DOWN: rmDown = true;
break;
case MouseEvent.RIGHT_MOUSE_UP: rmDown = false;
}
}
我的 Flash 导出到 Flash Player 11.2!也许我可以尝试使用 RIGHT_CLICK?