# ContextMenu not working

**URL:** https://forum.kirupa.com/t/contextmenu-not-working/274582
**Category:** flash
**Created:** [October 31, 2008, 5:41pm UTC](https://forum.kirupa.com/t/contextmenu-not-working/274582 "2008-10-31T17:41:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![marbuckim](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@marbuckim](https://forum.kirupa.com/u/marbuckim)
#### Post date: [October 31, 2008, 5:41pm UTC](https://forum.kirupa.com/t/contextmenu-not-working/274582/1 "2008-10-31T17:41:25Z")

</div>

Hi  
I need help please. Would appreciate very much if someone can help me on this.  
I have this very simple flash CS3 file. I am loading an external swf file into swf and **[COLOR=#ff0000]ContextMenu[/COLOR]** is not working on added swf.  
**[COLOR=#ff0000]ContextMenu[/COLOR]** shows menu items but does not click. The events on menu items are not firing.

Here is the code

stop();  
var \_contextMenu:ContextMenu;  
var \_contextMenuItems:Array = [“Yahoo”, “Google”, “MSN”];  
\_contextMenu = new **[COLOR=#ff0000]ContextMenu[/COLOR]**();  
\_contextMenu.hideBuiltInItems();

for (var i:uint = 0; i\<3; i++)  
{  
var menuItem:ContextMenuItem = new ContextMenuItem(\_contextMenuItems\*);  
\_contextMenu.customItems.push(menuItem);  
\*\*menuItem.addEventListener(ContextMenuEvent.MENU\_IT EM\_SELECT, handleContextMenu);  
\*\*}  
var request:URLRequest;  
var loader:Loader;  
request = new URLRequest(“[http://localhost/samplewebapplication/1.swf](http://localhost/samplewebapplication/1.swf)”);  
loader = new Loader();  
loader.contentLoaderInfo.addEventListener([Event.CO](http://Event.CO) MPLETE, loadComplete);  
function loadComplete(event:Event):void {  
trace(“Complete”);  
}  
loader.load(request);  
var temp\_mc:MovieClip=new MovieClip();  
temp\_mc.addChild(loader);  
emptyMovie.addChildAt(temp\_mc,0);  
**temp\_mc.contextMenu = \_contextMenu;**

function handleContextMenu(e:ContextMenuEvent):void {  
trace(“came here”);  
switch(ContextMenuItem(e.currentTarget).caption)  
{  
case “Yahoo”:  
trace(“Yahooooooooooo”);  
navigateToURL( new URLRequest(“[http://www.yahoo.com](http://www.yahoo.com)”),"\_blank");

break;  
case “Google”:  
trace(“Goooooooooogle”);  
navigateToURL( new URLRequest(“[http://www.google.com](http://www.google.com)”),"\_blank");

break;  
case “MSN”:  
navigateToURL( new URLRequest(“[http://www.msn.com](http://www.msn.com)”),"\_blank");  
break;

}  
}
