Removing the context menu in flash v11.2

Remember my rant about the whole “the unavoidable context menu of flash being a fucking insult to game developers” thing? Yeah, fun times.

Anyway, it turns out that since version 11.2 (released back in January) developers have been able to disable the context menu … but I’m only aware of this fact because I did an extremely specific google search that miraculously directed me to this very blog post that I’m linking by a “Game Developer Evangelist” at Adobe. That post has a nice and rather long-winded video of how to actually disable the context menu.

In short, it’s something like this*:

//Define a function to call when the right mouse button is pressed

protected function yourFunction(event:MouseEvent):void {}

//Somewhere in your code, add an event listener that listens to the right mouse button:

stage.addEventListener(MouseEvent.RIGHT_CLICK, yourFunction);

Easy!

The funny thing is, I already had this version of flash and I didn’t notice any of the new types of mouse events shown in the video. As it turns out, to be able to win the privilege of actually being able to take control of the right mouse button, you need to configure the crap out of your IDE. Well, at least in my case.

That IDE is FlashDevelop, by the way.

After 4 hours of trying things out, failing miserably, finding new configurations to toy around with, failing miserably again with no sign of improvement, I ended up solving the whole issue by searching yet again and finding the right blog post with the exact information I was looking for.

If you’ve been on the internet for any amount of time, you know perfectly well how unlikely that is, so excuse me while I savor the moment.

Developmeeeent, FUCK YEAH
Awwwww riiiiiight

AWESOME! Fuck Yeah! I can’t believe this. Blog Post, you’re the answer I’ve been looking for for more than a year. Yeah, that’s right, you naughty post. Mmmmhhhh, yeeeeessss.

*cough*

Yeah, so, that magical blog post that I was talking about is aptly called “Configuring FlashDevelop for Flash version 11.2” and is found in this here linky.

In the possible case that the blog post is lost forever or becomes inaccessible, let me copy & paste the steps for getting Flash Develop to work with Flash version 11.2. I’ve modified some of the steps a bit to reflect the changes done to the “Adobe Support Center” downloads page.

  1. Get the files.
    You can find the installation links here.

    • Launch the flash player 11.2 installer for your OS. This is required to be able to play 11.2 content on your browsers
    • Download the “playerglobal.swc to target the 11.2 APIs ”:
      • into “\FlashDevelop\Tools\flexsdk\frameworks\libs\player\11.2\” (create the 11.2 folder as it won’t exist)
      • save as “playerglobal.swc”.
    • Download the “Standalone Debugger”:
      • into “\FlashDevelop\Tools\flexlibs\runtimes\player\11.2\win\” (create the 11.2\win folders inside “player”)
      • save as “FlashPlayerDebugger.exe”.
  2. Configure FlashDevelop
    • Go to Tools -> Program Settings
    • Click on the “FlashViewer” plugin settings page
    • Set the “External Player Path” to point to your recently downloaded “11.2\win\FlashPlayerDebugger.exe” file.
  3. Configure your projects
    • Go to project properties by right clicking the project’s name.
    • Set the platform version to 11.2.
    • Add the following line to “Additional Compiler Options”:-swf-version=15
  4. Done, test your project!

If you follow these instructions, you’ll finally be able to get rid of that horrible, horrible context menu. However, if at least one of the configurations isn’t right, when you try to add a listener for the right-click you’ll get an error saying:

TypeError: Error #2007: Parameter type must be non-null.

And … well … that’s it really.

I’m kind of confused as to why I haven’t heard about any of this from any other site. Particularly gaming sites, now that I think about it. Oh well, I hope this helps somebody out there, because the solution to this issue is not very intuitive and might be conducive to some rage induced hair-pulling.

——————

*Wordpress doesn’t seem to have a handy way of displaying code, so a citation format will have to do. Luckily, it’s kinda legible only because it’s really simple and has no indentation whatsoever.

Image taken from here.

Advertisements

2 thoughts on “Removing the context menu in flash v11.2

  1. Thanks ,Diego. I missed the option “-swf-version=15” and I encountered that weird runtime error. This really helped me a lot.
    good job~

  2. Diego Doumecq

    Oh, it’s nothing. I’m just glad that this post has managed to help at least somebody. That was the whole reason why I wrote it 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s