Skip to main content
Participant
January 15, 2013
Question

MouseEvent.RIGHT_CLICK not working

  • January 15, 2013
  • 1 reply
  • 3308 views

So I can't get MouseEvent.RIGHT_CLICK to work. I'm using Flash CS6 and Flash Player version 11.5 (right click events were added in 11.4, I believe) but when I test the movie, right clicking does nothing.

Here is some test code that doesn't work:

public function Main()

{

     stage.addEventListener(MouseEvent.RIGHT_CLICK, traceText);

}

private function traceText(e:MouseEvent):void

{

     trace("click");

}

This successfully gets rid of the context menu that would normally pop up on the Flash player, but I'm not getting any traced text from right clicking on the stage.

This topic has been closed for replies.

1 reply

Participant
January 15, 2013

I figured out that although I had the Flash Player 11.5 installed, Flash CS6 was publishing to version 11.2. I downloaded the Flash Player Projector 11.5 and ran a test movie on it to see if MouseEvent.RIGHT_CLICK would work, and it did.

My test movie:

stage.addEventListener(MouseEvent.RIGHT_CLICK, rightClick);

stage.addEventListener(MouseEvent.CLICK, leftClick);

function rightClick(e:MouseEvent):void

{

          clickText.text = 'RIGHT';

}

function leftClick(e:MouseEvent):void

{

          clickText.text = 'LEFT';

}

So I updated Flash CS6 so I could publish 11.4 (which should work with the right clicking) and then set the publish settings and tested the movie. It didn't work.

I then opened up just the SWF file (not through Flash CS6) and the right clicking worked.

So now I have to figure out why it works when published, but not when testing it through Flash.

Inspiring
January 15, 2013

The player version that is used in the testing environment isn't necessarily updated when you update the plugin for your browsers.

I think there are ways to update the testing environment player, but I have never done it.

You can can use flash.system.Capabilities (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Capabilities.html) to see which version is being used.

Participant
January 15, 2013

I added a Capabilities.version textbox to the movie to see what version I was using, and when I run the standalone SWF, it is version 11.5, but when I test the movie through Flash, it uses version 11.4.

Crazy thing is that it should work fine in version 11.4, but it doesn't.

Instead of RIGHT_CLICK, I ended up just using RIGHT_MOUSE_DOWN, which for some reason works.