Skip to main content
Known Participant
May 20, 2007
Question

Context Menu

  • May 20, 2007
  • 13 replies
  • 554 views
OK, so i thought...i can make a menu when the user right clicks...A Context menu. I created a snazzy orange menu. I made the AS so that when a user right clicks, the movie appears when they click, and when the choose an option, the menu disappears. There are two things on my list:

1) How can you completely disable the context menu. I don't care how, be it software, actionscript, javascript, html or anything.

2) How can i make it so that there is function like "onClickOutside" (i know that isn't a function) where something happens when a user clicks outside the menu (it disappears as well)

Cheers experts,
Flash Cus
This topic has been closed for replies.

13 replies

Flash_CusAuthor
Known Participant
May 21, 2007
Thought i'd give the latest update. Yes i used SWF Studio to make it an EXE and disabled right click (it was an option). I opened the EXE and it works like a charm.

Cheers for everything,
Flash Cus
Inspiring
May 20, 2007
No probs... its possible in a regular flash windows projector exe to remove the right click menu by editing the 'resources' inside the exe and deleting the menu. I did it a few years back with a program called resource Hacker. I can't remember exactly what I did.
Flash_CusAuthor
Known Participant
May 20, 2007
Ok, i'll have a play with the exe thing and remove the regular menu that way. It doesn't have to be in a browser so i think it'll be ok. Thanks for all your help.

Cheers,
Flash Cus
Inspiring
May 20, 2007
I'm not sure, sorry, others may know more. I've only ever added items to the regular context menu itself and not tried to do exactly what I think you're doing.
Flash_CusAuthor
Known Participant
May 20, 2007
Actually i think that might be an adobe context menu thing because when i right click and choose "settings" then "close" i can click the items on my menu, but not when i just right click and then click on the menu...

Any thoughts?

Cheers,
Flash Cus
Flash_CusAuthor
Known Participant
May 20, 2007
Unfortunately now, whereever i click, the menu disappears. I'll post my AS:

onEnterFrame = function() {
if(Key.isDown(2)){
contextMenu._x = _xmouse;
contextMenu._y = _ymouse;
contextMenu._visible = true;
Mouse.addListener(onClickOutsideListener)
}

}

onClickOutsideListener = {}
onClickOutsideListener.onMouseDown = function() {
if (contextMenu.hitTest(_root._xmouse,_root._ymouse,true) == false) { //click outside
contextMenu._visible = false;
Mouse.removeListener(this);
}
}


Mouse.addListener(onClickOutsideListener)

//end of AS

Can u help even more?

Cheers again,
Flash Cus
Inspiring
May 20, 2007
Every time you make the menu visible you have to add the listener back again...like the first time:

Mouse.addListener(onClickOutsideListener)
Flash_CusAuthor
Known Participant
May 20, 2007
Ok further problem...the click outside thing only works the first time now the we've added the

Mouse.removeListener(this);

Line. Any thoughts?

Cheers,
Flash Cus
Inspiring
May 20, 2007
Oh, and put

Mouse.removeListener(this);

afer your new line
contextMenu._visible = false
Inspiring
May 20, 2007
Try putting the line

Mouse.addListener(onClickOutsideListener)

After the line of code that makes your menu visible in the first place