FreshNova - Home

Friday 30th of July 2010

Home Flash Tutorials Protect Your Game From Right Clicks
Protect Your Game From Right Clicks PDF Print E-mail
Written by Administrator   
Thursday, 22 January 2009 11:43

rightclick2

Right click any flash file, a menu will show up with many items, in the middle you will find "Rewind" and "Forward", those two items allows the user to move from frame to frame in the flash file. Well personally I learned it the hard way, I published a game without disabling the right click, and players were basically able to do whatever they wanted in the game. So for those of who youwho want to disable it follow these steps. This will be a bug in the game or an easy cheat for players to jump from level to level if each level of the game has its own frame.

The solution is to disable right clicks, as in the example below:


The following code shows you how to do that:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//Instance of ContextMenu
var menu:ContextMenu = new ContextMenu(); 

//Hide the default items
menu.hideBuiltInItems(); 

//Creating an item
var item1:ContextMenuItem = new ContextMenuItem("All rights reserved");

//Adding the item to the menu
menu.customItems.push(item1);

//Apply our menu plz!
this.contextMenu = menu;

 

This code will remove the items from the menu and add an item that says "All rights reserved".

 

You may creat new items and push them to the menu.

Write this code in the first frame in your flash file to disable right clicks in all frames.

 

You will find the source file in the attachments below.  

Enjoy it!!

Attachments:
FileFile sizeLast Modified
Download this file (DisableRightClick.fla)DisableRightClick48 Kb10/02/09 11:50

Comments

Name *
Email (For verification & Replies)
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Last Updated on Tuesday, 10 February 2009 12:00
 

Archive

 

Categories


Copyright © 2009 FreshNova, by Talha Kalim and Waleed Al-Bahrawy