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 20, 2007
Cheers!!!!! Works great...except...

This is my context menu problem. The initial click after the right click to bring up the menu, makes the menu disappear because of the listner. I put contextMenu._visible = false; instead of the trace. So the initial click seems to hide the menu and i don't know why? Is it to do with the flash context menu?

Any help?

Cheers 4 all the work,
Flash Cus
Flash_CusAuthor
Known Participant
May 20, 2007
Ok i've been experimenting but no luck. Thanks for the post btw. Can u give me a pointer on the AS?

Cheers
Inspiring
May 20, 2007
Well for the 'onClickOutside' I thought about it some more... you're probably already using the onRollOver and onRollOut inside the menu, and unless it has a border it might be tricky to code the onRollout for the mouseDown listener.

If your menu is totally contained within a clip called myMenu then you could do something like:

onClickOutsideListener = {}
onClickOutsideListener.onMouseDown = function() {
if (myMenu.hitTest(_root._xmouse,_root._ymouse,true) == false) { //click outside
trace("onClickOutSide call a function to hide the menu")
}
}


Mouse.addListener(onClickOutsideListener)
Inspiring
May 20, 2007
You can't disable the context menu in a browser based flash player. Period. You can reduce what it displays to the minimum mandatory items, but that's it.

If you're creating standalone projectors you can use something that edits the resources in a windows exe to remove the context menus in a regular flash projector (I don't know about Mac)- although I've done this sucessfully in the past its been a long time and I can't remember exactly what I did. Or if you use a 3rd party tool like Zinc or SWF Studio or Jugglor or (probably lots of others) I'm sure you could do it with some of their options in a much easier way.

I assume your 'orange menu' is a type of movieclip. You could watch for an onRollout event... then use a Mouse listener for the onMouseDown event.
onRollover would need to cancel your Mouse listener.