Author Topic: Disable in-game Right-Click?  (Read 1605 times)

eleder

  • Member
  • **
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Disable in-game Right-Click?
« on: Thu, Dec 15, 2011 »
Quick question: How do I disable the flash right-click menu using Flixel?

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Disable in-game Right-Click?
« Reply #1 on: Thu, Dec 15, 2011 »
This needs to go in your Main.as:

Code: [Select]
var myMenu:ContextMenu = new ContextMenu();
myMenu.hideBuiltInItems();
this.contextMenu = myMenu;

You can't disable the menu entirely, it's impossible. But the above will remove lots of the items from it.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

eleder

  • Member
  • **
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Disable in-game Right-Click?
« Reply #2 on: Thu, Dec 15, 2011 »
I'll implement this right now. Thanks for the response!


claudiovc

  • Member
  • **
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Disable in-game Right-Click?
« Reply #3 on: Fri, Dec 16, 2011 »
Exactly, as far as I know, you can't hide Settings (because that's where the user can change storage/privacy parameters) or About. There are some 'workarounds' to disable the ContextMenu that involves capturing the right-click in the HTML/Javascript.... it wouldn't work if would play the .swf directly without the html wrapper.
Here's a link: http://blog.another-d-mention.ro/programming/right-click-and-custom-context-menu-in-flash-flex/

c023-DeV

  • Game Artisan
  • Active Member
  • ***
  • Posts: 176
  • Karma: +0/-0
    • View Profile
    • DeV-ZoO
Re: Disable in-game Right-Click?
« Reply #4 on: Sat, Dec 17, 2011 »
Ok, I sorry that this might be dumb: but FD says that ContextMenu is not a compile time constant =( ?!
Do I have to make an empty class for it to work? Sorry
If you aint got no dedication, you won't get no education!

wg/funstorm

  • Global Moderator
  • Key Contributor
  • *****
  • Posts: 596
  • Karma: +0/-0
    • View Profile
    • Funstorm
Re: Disable in-game Right-Click?
« Reply #5 on: Sat, Dec 17, 2011 »
Import flash.ui.ContextMenu at the top of your class.

c023-DeV

  • Game Artisan
  • Active Member
  • ***
  • Posts: 176
  • Karma: +0/-0
    • View Profile
    • DeV-ZoO
Re: Disable in-game Right-Click?
« Reply #6 on: Sat, Dec 17, 2011 »
Cheers =D

I tryed importing flash.* but that didnt help so I got confused =)

See, this is the darker side of makeing games without actual programming background, harhar...
If you aint got no dedication, you won't get no education!