# Need to remove right click menu if it doesnt have a parent

**URL:** <https://forum.kirupa.com/t/need-to-remove-right-click-menu-if-it-doesnt-have-a-parent/285430>\
**Category:** flash\
**Created:** [March 31, 2009, 6:01pm UTC](https://forum.kirupa.com/t/need-to-remove-right-click-menu-if-it-doesnt-have-a-parent/285430 "2009-03-31T18:01:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [March 31, 2009, 6:01pm UTC](https://forum.kirupa.com/t/need-to-remove-right-click-menu-if-it-doesnt-have-a-parent/285430/1 "2009-03-31T18:01:16Z")

</div>

I have a web site built in flash and an admin panel built in flash that you access via right click. It loads admin.swf.

Basically I want to remove the right click menu if a user goes directly to [http://blah.com/admin.swf](http://blah.com/admin.swf)

If I do stage.showDefaultContextMenu = false;

the second I load the admin panel, it removes my context menu that I built in my parent movie. Can anyone think of a solution?

EDIT::

I have this on the first frame of my admin.swf:

```auto

function controlMenu():void
{
	if (MovieClip(parent.parent.parent) == null)
	{
		stage.showDefaultContextMenu = false;
	}
}
controlMenu();

```

basically if the parent evaluates to null (meaning it doesnt have a parent) remove the context menu, but when I compile I get this error:

```auto

TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at admin_fla::MainTimeline/controlMenu()[admin_fla.MainTimeline::frame1:5]
	at admin_fla::MainTimeline/admin_fla::frame1()[admin_fla.MainTimeline::frame1:10]

```

which is really no surprise…I dont know how to do this ☹
