2

I am trying to create a boolean where it checks if the right-mouse button is pressed or not. With the left mouse button this method works, but with the right mouse button the boolean stays true, how do I fix this?

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;
    }
}

My Flash exports to Flash Player 11.2! Maybe I can try something with RIGHT_CLICK?

tversteeg
  • 4,717
  • 10
  • 42
  • 77

1 Answers1

3

This seems to be a player version problem. Right-click-up compiles, but fails silently at runtime in 11.2. It compiles and runs fine in 11.4. I tested in Flash CS6, where my player version is WIN 11,2,202,228, and got exactly the same silent failure that you report.

I then tested in FlashDevelop (swapping the right mouse enums for "rightMouseDown" and "rightMouseUp", because completion on my version doesn't recognise the new enum event values), and tested with projector debugger version WIN 11,4,402,265, and right mouse down and up both worked fine. It also works fine in the latest production release of the plugin and active X players, versions 11.4.* across IE, Firefox and Chrome, on a Win 7 machine.

I'm not sure what development environment you're using, and if its Flash Pro CS* then I'm not sure how you upgrade the player version, but it should be straightforward with FlashBuilder or FlashDevelop. And I'm sure you know already that you can use flash.system.Capabilities.version to double-check what player version you are testing in. I was surprised to find CS6 still using 11.2 when the .swf file association in my system is normally with the 11.4 debugger.

Jude Fisher
  • 11,138
  • 7
  • 48
  • 91
  • Well I have Flash CS6, and I am trying to update it but that doesn't work, so I guess I'll install FlashBuilder. – tversteeg Sep 01 '12 at 12:07
  • Maybe post back here if you figure out how to upgrade the player that CS6 uses. I haven't been able to. – Jude Fisher Sep 01 '12 at 13:09